Re: Regression in `git diff --quiet HEAD` when a new file is staged
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 22, 2025, 14:31 UTC
- Message-ID
- <xmqqa51j0zzj.fsf@gitster.g>
- In-Reply-To
- <E76C71D8-103E-4C37-B05C-86DC180BD519@gmail.com>
Lidong Yan <yldhome2d2@gmail.com> writes:
Show 11 quoted lines
>> + diff_free_file(o);
>> + o->file = xfopen("/dev/null", "w");
>> + o->close_file = 1;
>> + o->color_moved = 0;
>> o->dry_run = 1;
>> o->found_changes = 0;
>> diff_flush_patch(p, o);
>>
>
> This would make everything going to "/dev/null" after the flush_quietly() call.
> I think we need to restore o->file.Ah, true, the original location was only for NO_OUTPUT but the other caller to the diff_flush_patch_quietly() helper does deal with other cases as well.
Thanks.