git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Regression in `git diff --quiet HEAD` when a new file is staged

From
Jeff King <peff@peff.net>
Date
Oct 22, 2025, 09:11 UTC
Message-ID
<20251022091112.GB853931@coredump.intra.peff.net>
In-Reply-To
<xmqqy0p4wcac.fsf@gitster.g>
On Tue, Oct 21, 2025 at 07:38:03AM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> > So really, the regression fix should probably cover both of them (which
> > it would if we move the /dev/null redirection into the flush_quietly()
> > variant).
> 
> Do you mean something like this on top of your patch for 'maint',
> and the latest from Lidong to the 'master' front, then?

Yep, exactly (though with the "o->file" restoration that Lidong pointed out).

Show 5 quoted lines
> Having calls to this helper in two loops in one function looks a bit
> awkward but the conditions to enter these two loops are mutually
> exclusive, so it is not like we can remember the result of the calls
> we make in the first loop and reuse in the second loop, so this
> probably is the best we can do.

Yeah. I suspect there is some formulation along the lines of: if we have diff_from_contents set but are not looking at a content-level diff, then up-front in diff_flush() we should quietly flush each to find out what is changed and what is not. But the loop for NAME_STATUS, etc, needs to know _which_ pairs still had changes (whereas --quiet only cares about whether there were any changes at all). So we'd have to store that somewhere.

And of course the chance of regressing some unconsidered corner case is high. Definitely not something we should entertain while doing another regression fix. ;)

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 20 of 27 in “Regression in `git diff --quiet HEAD` when a new file is staged”
  1. Jake ZimmermanOct 17, 2025
  2. Jeff KingOct 17, 2025
  3. diff: restore redirection to /dev/null for diff_from_contentsJeff King, Oct 17, 2025
  4. Junio C HamanoOct 17, 2025
  5. Johannes SchindelinOct 19, 2025
  6. Jeff KingOct 21, 2025
  7. Johannes SchindelinOct 17, 2025
  8. Junio C HamanoOct 17, 2025
  9. Lidong YanOct 18, 2025
  10. Jeff KingOct 18, 2025
  11. Jeff KingOct 18, 2025
  12. Junio C HamanoOct 18, 2025
  13. Jeff KingOct 21, 2025
  14. Junio C HamanoOct 21, 2025
  15. Lidong YanOct 22, 2025
  16. Jeff KingOct 22, 2025
  17. Lidong YanOct 22, 2025
  18. Junio C HamanoOct 22, 2025
  19. Junio C HamanoOct 22, 2025
  20. Jeff KingOct 22, 2025
  21. Junio C HamanoOct 22, 2025
  22. Jeff KingOct 23, 2025
  23. Jeff KingOct 23, 2025
  24. Junio C HamanoOct 23, 2025
  25. Junio C HamanoOct 22, 2025
  26. Lidong YanOct 23, 2025
  27. Junio C HamanoOct 23, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.