GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — diff: return the difference status in side-by-side mode by SichenLiang · Pull Request #291 · uutils/diffutils Conversation
|
| } | ||
|
|
||
| // Side-by-side writes its output directly, so its result cannot indicate differences. | ||
| let side_by_side_differs = params.format == Format::SideBySide && from_content != to_content; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
could side_diff::diff return whether it found differences instead of vec![]?
then we don't need this special case (or the comment)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done. side_diff::diff now returns whether it saw a changed line
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| eprintln!("{error}"); | ||
| exit(2); | ||
| }), | ||
| Format::SideBySide if params.brief => Vec::new(), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
if side_diff returns the status, do we still need this arm? a sink writer would do
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I removed that branch. With -q, the renderer still runs but writes to io::sink().
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
|
|
||
| #[test] | ||
| fn side_by_side_exit_status() -> Result<(), Box<dyn std::error::Error>> { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
this test does too many things, could you please split it (exit status, -q, -s, missing file)?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done. I split it into separate tests for the exit status, -q, -s, and a missing file.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
|
|
||
| std::fs::write(&left, b"alpha\n")?; | ||
| for (right_content, identical) in [(b"alpha\n".as_slice(), true), (b"bravo\n", false)] { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
-y -s is already run in the loop above, could this be merged there?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sure -y -s is now another row in the table.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| .code(predicate::eq(2)) | ||
| .failure() | ||
| .stdout(predicate::str::is_empty()) | ||
| .stderr(predicate::str::contains("right")); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
please check the full error message, "right" is weak
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done. The test now checks the complete error message.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Return whether `side_diff::diff` saw a changed line and use that value for the exit status instead of comparing the inputs again. With `-y -q`, keep running the renderer but send its output to `io::sink()`, so only the brief message is printed.
b99b21e to
6fc1ac5
Compare
Merging this PR will degrade performance by 7.93%2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
sorry but it needs to be rebased, and a bunch of jobs are failing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
diff: return the difference status with -y
There was an error while loading. Please reload this page.