Merge branch 'jk/diff-from-contents-fix' into ly/diff-name-only-with-diff-from-content

* jk/diff-from-contents-fix:
  diff: restore redirection to /dev/null for diff_from_contents
This commit is contained in:
Junio C Hamano
2025-10-22 12:58:50 -07:00
2 changed files with 13 additions and 0 deletions

9
diff.c
View File

@@ -6890,6 +6890,15 @@ void diff_flush(struct diff_options *options)
if (output_format & DIFF_FORMAT_NO_OUTPUT &&
options->flags.exit_with_status &&
options->flags.diff_from_contents) {
/*
* run diff_flush_patch for the exit status. setting
* options->file to /dev/null should be safe, because we
* aren't supposed to produce any output anyway.
*/
diff_free_file(options);
options->file = xfopen("/dev/null", "w");
options->close_file = 1;
options->color_moved = 0;
for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
if (check_pair_status(p))