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

Re: git rename/moved status unreliable in ruby

From
Johannes Sixt <j6t@kdbg.org>
Date
May 2, 2026, 07:25 UTC
Message-ID
<157dd2e5-ce64-4654-a66a-86a552c7c9f1@kdbg.org>
In-Reply-To
<026b84f4-7052-4d5b-a9ae-c2487569d1ee@gmail.com>
Am 01.05.26 um 17:30 schrieb Phillip Wood:
Show 7 quoted lines
> Rename detection is based on how similar the two files are. Looking at
> the example you linked to below you're changing a file that looks like
> 
> ...
> 
> Which means that git sees that every line has changed because the
> indentation has changed.
That's correct, of course, but...
> If you want git to realize that the file has
> been renamed you could move it in one commit and then add modify it in
> the next commit.

... this is a fallacy. Splitting into two commits helps only certain cases, in particular, when the commit that moves the files is compared to an earlier commit, such as `git log` does. However, if a commit after the change is compared to a commit before the move, the rename is still not detected.

-- Hannes
Previous: Phillip WoodNext: Junio C Hamano
Message 3 of 9 in “git rename/moved status unreliable in ruby”
  1. sebastien.stettlerMay 1, 2026
  2. Phillip WoodMay 1, 2026
  3. Johannes SixtMay 2, 2026
  4. Junio C HamanoMay 3, 2026
  5. Chris TorekMay 2, 2026
  6. sebastien.stettlerMay 2, 2026
  7. Jeff KingMay 4, 2026
  8. Junio C HamanoMay 5, 2026
  9. Chris TorekMay 5, 2026

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.