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
Junio C Hamano <gitster@pobox.com>
Date
Oct 18, 2025, 15:23 UTC
Message-ID
<xmqqh5vww7xa.fsf@gitster.g>
In-Reply-To
<20251018094037.GA1060824@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 6 quoted lines
> I'm not sure which of these you mean:
>
>   - Do we still need to call diff_flush_patch_quietly() directly below
>     the hunk above, in diff_flush()?
>
>   - Do we still need the dry-run code at all?

Both. We do not have to call flush_quietly() and can call the real thing with output disabled. The dry-run bit was only added to implement the flush_quietly() variant. If we lose the only caller to flush_quietly(), all of the supporting infrastructure can go.

It concentrates only on the regression-fix aspect of the changes. Going forward, my preference is:

 * Apply your patch.  This is the base of the fix for 'maint' and
   all branches.
 * As Lidong updates dry-run code by adding more "ah we are in
   dry-run, so we should stop at the first change and se should be
   silent" fixes, we can queue them on the 'master' front for the
   preparation for a better future.  Note that the 'master' front
   would contain your "In from_contents modes, run flush_quietly()
   with output redirected to /dev/null".
 * Once we regain enough confidence for dry-run with the above
   effort, we mark your "why not redirect to /dev/null for extra
   protection?" code with NEEDSWORK comment to be removed after a
   thorough code audit to ensure that dry-run is now sound.

And I do not mind if the NEEDSWORK comment stay there for extended period of time.

Thanks.
Previous: Jeff KingNext: Jeff King
Message 12 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.