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

Unexpected behavior on diff -I<regex> --name-only

From
Johannes Altmanninger <aclopte@gmail.com>
Date
Dec 14, 2020, 19:00 UTC
Message-ID
<20201214190054.lrdllbpf6jfrz573@gmail.com>

Since v2.28.0-2-g296d4a94e7 (diff: add -I<regex> that ignores matching changes) diff -I<regex> can be used to suppress hunks of only matching lines. This interacts in a surprising way with --name-only, which lists all changed files, regardless of whether they are filtered out by -I<regex>:

	git diff HEAD~ -I ''			# always empty
	git diff HEAD~ -I '' --name-only	# not empty, "-I" does nothing

It could be nice to only show names of files with matching hunks (or reject this combination of options?).

Next: Junio C Hamano
Message 1 of 7 in “Unexpected behavior on diff -I<regex> --name-only”
  1. Johannes AltmanningerDec 14, 2020
  2. Junio C HamanoDec 14, 2020
  3. Johannes AltmanningerDec 16, 2020
  4. diff: suppress --name-only paths where all hunks are ignoredJohannes Altmanninger, Dec 16, 2020
  5. Re* [PATCH] diff: suppress --name-only paths where all hunks are ignoredJunio C Hamano, Dec 17, 2020
  6. Re* [PATCH] diff: suppress --name-only paths where all hunks are ignoredJohannes Altmanninger, Dec 20, 2020
  7. Junio C HamanoDec 21, 2020

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.