Repository navigation
Conversation
Put a tab instead of a space between the line marker and the line in the normal, context and unified formats, as GNU diff does.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
diff -T/--initial-tabwas rejected as an unrecognized option. GNU diff uses it to put a tab between the line marker and the line, so that tabs in the text line up the same way they do in the files:This adds the option to
Paramsand handles it inline_prefix, which the normal, context and unified formats already use for their markers. The space that ends the marker becomes a tab (<→<\t,!→!\t, the unified context marker→\t), and a tab is added after the unified-and+.--suppress-blank-emptystill drops the marker's blank on empty lines, as in GNU. The ed, ifdef and side-by-side formats are unchanged, and GNU doesn't change them either.I compared
-T,--initial-tab,-T -u,-T -c,-T -U0,-T -C1,-T -e,-T -D X,-T -t,-T -t -u,-T -qand-Twith--suppress-blank-emptyagainst GNU diff 3.12 on two pairs of files (one with an empty line and a tab in the text). The output and exit status match.The new
initial_tabcases fail on main and pass with this change.cargo fmt --checkandcargo clippy -- -D warningsare clean.cargo testfails onlyifdef_diff_identical,ifdef_diff_identical_reportandifdef_diff_missing_newline, which fail onmainas well; #444 fixes those.I used Claude Code (Opus 5.5) to help investigate and draft this change; I checked the output against GNU diff myself.