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

Re: git log --name-only improvement: show old file name in rename

From
NFNathan Faulkner <natedogith1@gmail.com>
Date
May 16, 2024, 23:13 UTC
Message-ID
<c239ab15-4d48-4328-8bd5-8e2d77163e03@gmail.com>
In-Reply-To
<BL0PR11MB34608AE271344D508676D17A9D9C0@BL0PR11MB3460.namprd11.prod.outlook.com>

The documentation for --name-only says "Show only names of changed files." I would interpret this to mean "output the names of all files that changed", not "output the names of all files that changed, unless git detected it as renamed". --no-renames makes it behave as expected, but having to specify it isn't obvious. A warning in the documentation could help, but --no-renames should probably be included by default when --name-only is specified.

I ran into an issue today with code that expected git diff --name-only to output all changed files. A file was created and an unrelated file was deleted in the same commit, but they happened to be similar enough that git detected it as rename, and thus git diff --name-only indicated only one file changed when two files were actually changed.

Previous: Ed AvisNext: Junio C Hamano
Message 6 of 9 in “git log --name-only improvement: show old file name in rename”
  1. Ed AvisJun 11, 2020
  2. Junio C HamanoJun 11, 2020
  3. Philip OakleyJun 12, 2020
  4. Junio C HamanoJun 12, 2020
  5. Ed AvisJun 15, 2020
  6. Nathan FaulknerMay 16, 2024
  7. Re*: git log --name-only improvement: show old file name in renameJunio C Hamano, May 17, 2024
  8. Nathan FaulknerMay 18, 2024
  9. Junio C HamanoMay 18, 2024

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.