Re: Regression in `git diff --quiet HEAD` when a new file is staged
- From
Jeff King <peff@peff.net>
- Date
- Oct 18, 2025, 09:42 UTC
- Message-ID
- <20251018094245.GB1060824@coredump.intra.peff.net>
- In-Reply-To
- <918E56B8-7009-4E8E-A98E-AC5B9CE4DD7C@gmail.com>
On Sat, Oct 18, 2025 at 09:04:40AM +0800, Lidong Yan wrote:
> I believe we can move Peff’s code from diff_flush() to diff_flush_patch_quiet(). > However, I'm unsure whether we should remove the dry-run logic. In dry-run > mode, we would halt as early as possible in xdl_diff by using quick_consume().
Yeah, exactly.
I am OK to put the /dev/null code into diff_flush_patch_quiet(). That would give all callers the same belt-and-suspenders protection.
The patch I posted put it where it was because that's where it was prior to b55e6d36eb. It is essentially a revert (because I only wanted one hunk I didn't call "git revert", but rather did a reversed patch application).
But after that revert, I think it would be reasonable to move the code on top (with the justification that it is helping the other caller of the _quiet function).
-Peff