From: Lidong Yan Date: Thu, 23 Oct 2025 00:33:48 GMT Subject: Re: Regression in `git diff --quiet HEAD` when a new file is staged Message-ID: <09150C80-0238-49C3-BAA2-42983741C905@gmail.com> In-Reply-To: Junio C Hamano writes: > > ----- >8 ----- > Subject: [PATCH] diff: make sure the other caller of diff_flush_patch_quietly() is silent > > Earlier, we added is a protection for the loop that computes "git > diff --quiet -w" to ensure calls to the diff_flush_patch_quietly() > helper stays quiet. Do the same for another loop that deals with > options like "--name-status" to make calls to the same helper. > > Signed-off-by: Junio C Hamano > --- > diff.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/diff.c b/diff.c > index 9b8d658b9e..ceb57d1ef8 100644 > --- a/diff.c > +++ b/diff.c > @@ -6814,6 +6814,16 @@ void diff_flush(struct diff_options *options) > DIFF_FORMAT_NAME | > DIFF_FORMAT_NAME_STATUS | > DIFF_FORMAT_CHECKDIFF)) { > + /* > + * make sure diff_Flush_patch_quietly() to be silent. > + */ > + FILE *saved_file = options->file; > + int saved_color_moved = options->color_moved; > + > + if (options->flags.diff_from_contents) { > + options->file = xfopen("/dev/null", "w"); > + options->color_moved = 0; > + } > for (i = 0; i < q->nr; i++) { > struct diff_filepair *p = q->queue[i]; > > @@ -6826,6 +6836,11 @@ void diff_flush(struct diff_options *options) > > flush_one_pair(p, options); > } > + if (options->flags.diff_from_contents) { > + fclose(options->file); > + options->file = saved_file; > + options->color_moved = saved_color_moved; > + } > separator++; > } > > -- > 2.51.1-633-gaa2b1236d0 > Do you think we should make a new ‘going to be flushed’ queue and flush them out of ‘quiet’ loop would be a good idea? I think we shouldn’t discard output of flush_one_pair(). Thanks, Lidong