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.
| let stdout = result.stdout_str(); | ||
| let body = if args.contains(&"-u") { | ||
| stdout.splitn(3, '\n').nth(2).unwrap() | ||
| } else if args.contains(&"-c") { |
There was a problem hiding this comment.
both branches are the same, could be merged with a ||, no?
| params.ignore_tab_expansion = true; | ||
| continue; | ||
| } | ||
| if param == "-T" || param == "--initial-tab" { |
There was a problem hiding this comment.
please add -T / --initial-tab cases to the parse_params tests too, like -E
# Conflicts: # tests/by-util/test_diff.rs
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.
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.