summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-10-24 09:10:37 -0700
committerJunio C Hamano <gitster@pobox.com>2025-10-24 09:10:37 -0700
commit88b3704ab17b16d5d6f7f5cf7129e800ad22e282 (patch)
treead9ca29194daae36fe845473e33f20765643753e /diff.c
parentc54a18ef67e59cdbcd77d6294916d42c98c62d1d (diff)
parent623f7af28417805d941b1618157b9d93c02347af (diff)
Merge branch 'jk/diff-from-contents-fix'
Recently we attempted to improve "git diff -w" and friends to handle cases where patch output would be suppressed, but it introduced a bug that emits unnecessary output, which has been corrected. * jk/diff-from-contents-fix: diff: restore redirection to /dev/null for diff_from_contents
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 87fa16b730..687206f353 100644
--- a/diff.c
+++ b/diff.c
@@ -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))