Repository navigation
fix: return correct exit status for side-by-side diff #403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dex0o0
wants to merge
12
commits into
uutils:main
Choose a base branch
from
dex0o0:fix-side-by-side-exit-status
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+92
−29
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4c981f7
fix: return correct exit status for side-by-side diff
dex0o0 0a55fc6
fix: silence unused side diff warning
dex0o0 d8c0969
fix: scope dead code allowance to binary module
dex0o0 39e75de
docs: restore side-by-side diff disclaimer
dex0o0 34f5bb0
test: document identical side-by-side regression
dex0o0 64324e7
test: cover different files exit status in side-by-side mode
dex0o0 0f54b92
refactor: simplify side-by-side diff API
dex0o0 e83d30e
refactor: simplify diff status handling
dex0o0 da380d4
refactor: simplify diff result handling
dex0o0 3862c13
perf: avoid repeated side-by-side diff iteration
dex0o0 3eadee7
style: preserve side-by-side diff formatting
dex0o0 f3d9089
test: cover side-by-side diff exit status
dex0o0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -802,6 +802,54 @@ fn sdiff_gutter_marker_column(#[case] options: &[&str], #[case] expected: &str) | |
| .stdout_is(expected); | ||
| } | ||
|
|
||
| #[test] | ||
| fn sdiff_different_files_exit_failure() { | ||
| let (at, ts) = at_and_ts!(); | ||
| at.write("file1", "first\n"); | ||
| at.write("file2", "second\n"); | ||
|
|
||
| ts.ucmd().args(&["-y", "file1", "file2"]).fails_with_code(1); | ||
| } | ||
|
|
||
| #[test] | ||
| fn sdiff_brief_different_files_exit_failure() { | ||
| let (at, ts) = at_and_ts!(); | ||
| at.write("file1", "first\n"); | ||
| at.write("file2", "second\n"); | ||
|
|
||
| ts.ucmd() | ||
| .args(&["-q", "-y", "file1", "file2"]) | ||
| .fails_with_code(1) | ||
| .stdout_contains("Files file1 and file2 differ\n"); | ||
| } | ||
|
|
||
| #[test] | ||
| fn sdiff_recursive_header() { | ||
| let (at, ts) = at_and_ts!(); | ||
| at.mkdir("left"); | ||
| at.mkdir("right"); | ||
| at.write("left/file", "first\n"); | ||
| at.write("right/file", "second\n"); | ||
|
|
||
| ts.ucmd() | ||
| .args(&["-r", "-y", "left", "right"]) | ||
| .fails_with_code(1) | ||
| .stdout_contains("diff -r -y left/file right/file\n"); | ||
| } | ||
|
|
||
| // Regression test: identical files must return exit code 0 in side-by-side mode. | ||
| #[test] | ||
| fn sdiff_identical_files_exit_success() { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please also add a test for |
||
| let (at, ts) = at_and_ts!(); | ||
| at.write("file1", "same\n"); | ||
| at.write("file2", "same\n"); | ||
|
|
||
| ts.ucmd() | ||
| .args(&["-y", "file1", "file2"]) | ||
| .succeeds() | ||
| .no_stderr(); | ||
| } | ||
|
|
||
| #[rstest] | ||
| #[case::delete_and_append( | ||
| "north\neast\nsouth\nwest\n", | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep the blank lines, unrelated change