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

Re: [PATCH] diff: ensure consistent diff behavior with -I<regex> across output formats

From
Jeff King <peff@peff.net>
Date
Aug 4, 2025, 12:42 UTC
Message-ID
<20250804124218.GA86602@coredump.intra.peff.net>
In-Reply-To
<xmqqtt2nd7k6.fsf@gitster.g>
On Sun, Aug 03, 2025 at 09:39:21PM -0700, Junio C Hamano wrote:
Show 14 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > .... It affects all of raw, name-only,
> > name-status, and checkdiff. I know Junio said that --raw should not be
> > affected, but I'm not sure I agree.
> 
> I no longer am sure if I agree.  I do not mind a raw entry that
> would show different object name for preimage and postimage for a
> path to be omitted when --ignore-whatever is passed and the blobs
> compare "equal" under the specified "ignore" criteria.
> 
> The behaviour sounds somewhat incoherent, but that is what the user,
> who passes both --raw and --ignore-whatever to the command at the
> same time, wants.

Yeah, exactly. It definitely is weird, but it feels like the closest thing to what the user asked for.

Just trying to play devil's advocate on this whole topic: is there anybody who could complain about omitting these entries from raw or name-only lists? IMHO it is weird and a bug that:

  git diff --name-only --raw -p -w <commit...>

might show an entry in the name-only and raw lists that doesn't also end up in the actual patch. For just:

  git diff --name-only --raw -w

it is easy to say "well, why did you pass -w if you did not want content-level inspection?". But when they are combined, could the current behavior ever be preferred?

The two counterpoints I can think of are:
  1. Maybe that is an interesting signal to somebody that the diff _did_
     touch that path, but it just had no content-level change. I am
     having trouble imagining why that is useful, but it's not outside
     the realm of possibility. And certainly you could get that
     information separately by running a tree-level raw diff (without
     "-w") followed by a "-p -w" diff (and if you use diff-pairs, that
     second diff can even skip doing the tree-diff again).
  2. 99% of the time, "-w" (or -I, or whatever) will not remove the
     entirety of the change from those files. So we will do a whole
     content-level diff just to say "yep, we still should mention this
     in --raw"). Is the extra computation worth it?
-Peff
Previous: Junio C HamanoNext: Lidong Yan
Message 19 of 35 in “git-diff: --ignore-matching-lines has no effect on the output when --name-only is used”
  1. hi@arnes.spaceJul 23, 2025
  2. Lidong YanJul 23, 2025
  3. Junio C HamanoJul 23, 2025
  4. Lidong YanJul 24, 2025
  5. Eric SunshineJul 24, 2025
  6. Lidong YanJul 24, 2025
  7. hi@arnes.spaceJul 25, 2025
  8. hi@arnes.spaceJul 25, 2025
  9. Lidong YanJul 25, 2025
  10. hi@arnes.spaceJul 25, 2025
  11. Jeff KingJul 25, 2025
  12. Junio C HamanoJul 25, 2025
  13. diff: ensure consistent diff behavior with -I<regex> across output formatsLidong Yan, Jul 29, 2025
  14. Junio C HamanoJul 30, 2025
  15. Jeff KingAug 2, 2025
  16. Lidong YanAug 3, 2025
  17. Junio C HamanoAug 3, 2025
  18. Junio C HamanoAug 4, 2025
  19. Jeff KingAug 4, 2025
  20. diff: ensure consistent diff behavior with -I<regex> across output formatsLidong Yan, Aug 3, 2025
  21. Junio C HamanoAug 4, 2025
  22. Lidong YanAug 4, 2025
  23. Junio C HamanoAug 4, 2025
  24. Lidong YanAug 5, 2025
  25. Junio C HamanoAug 5, 2025
  26. diff: ensure consistent diff behavior with ignore optionsLidong Yan, Aug 6, 2025
  27. Junio C HamanoAug 6, 2025
  28. Lidong YanAug 7, 2025
  29. Junio C HamanoAug 6, 2025
  30. Lidong YanAug 7, 2025
  31. diff: ensure consistent diff behavior with ignore optionsLidong Yan, Aug 7, 2025
  32. Junio C HamanoAug 7, 2025
  33. Lidong YanAug 8, 2025
  34. diff: ensure consistent diff behavior with ignore optionsLidong Yan, Aug 8, 2025
  35. Johannes SchindelinOct 16, 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.