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

Re: problem with git detecting proper renames

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Nov 29, 2007, 19:27 UTC
Message-ID
<alpine.LFD.0.9999.0711291122050.8458@woody.linux-foundation.org>
In-Reply-To
<28BD703B-24D3-41D6-8360-240A884B1305@kernel.crashing.org>
On Thu, 29 Nov 2007, Kumar Gala wrote:
> 
> In the case of multiple identical matches can we look at the file name as a
> possible heuristic?

We already do. But we only do the base-name part and check it for exactness, since moving across directories is very common, and we explicitly want to pick up files that have the same base name.

However, in your case, not only did you have the same content, you had the same basename too! So git considered your renames to be totally identical wrt scoring with the current heuristics, and just picked one source at random.

And the current heuristics don't even have any "if you already found a rename, avoid picking the same one twice", so it would pick the *same* source both times, which is why it looked like "two copies and one delete".

This is why I'd like to have a real-life example. I can change the heuristics, and I even know what are likely to be better heuristics, but I still want to actually see and play with an example so that when I send Junio a patch, I can explain it and say I've tested it with something real..

			Linus
Previous: Kumar GalaNext: Kumar Gala
Message 4 of 14 in “problem with git detecting proper renames”
  1. Kumar GalaNov 29, 2007
  2. Linus TorvaldsNov 29, 2007
  3. Kumar GalaNov 29, 2007
  4. Linus TorvaldsNov 29, 2007
  5. Kumar GalaNov 29, 2007
  6. Kumar GalaNov 29, 2007
  7. Fix a pathological case in git detecting proper renamesLinus Torvalds, Nov 29, 2007
  8. Linus TorvaldsNov 29, 2007
  9. Jeff KingNov 29, 2007
  10. Linus TorvaldsNov 30, 2007
  11. Jeff KingNov 30, 2007
  12. Kumar GalaNov 30, 2007
  13. Junio C HamanoNov 30, 2007
  14. Jakub NarebskiNov 30, 2007

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.