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

Re: [PATCH] diffcore-rename: favour identical basenames

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jun 21, 2007, 16:20 UTC
Message-ID
<alpine.LFD.0.98.0706210910390.3593@woody.linux-foundation.org>
In-Reply-To
<20070621131915.GD4487@coredump.intra.peff.net>
On Thu, 21 Jun 2007, Jeff King wrote:
Show 9 quoted lines
> On Thu, Jun 21, 2007 at 12:52:11PM +0100, Johannes Schindelin wrote:
> 
> > When there are several candidates for a rename source, and one of them
> > has an identical basename to the rename target, take that one.
> 
> That's a reasonable heuristic, but it unfortunately won't match simple
> things like:
> 
>   i386_widget.c -> arch/i386/widget.c
We'e also had things like
	arch/i386/kernel/pci-pc.c -> arch/i386/kernel/pci/common.c

so it's not always the ending of a file that is unchanged, but you still often have some "similarity" of the name (ie the "pci" substring is still common there).

So I agree that we can be even better about the heuristics. I don't know how much it *matters* in practice.

I do agree with the people who argue that you simply shouldn't depend on these kinds of things, and if you have identical files, and move them around, you really are getting behaviour that doesn't matter.

The files are *identical* for christ sake! Following their history, it doesn't matter *which* base you follow, since regardless, they've come to the same point!

So in that sense, the current git behaviour is actually perfectly fine.

At the same time, I'll argue from a totally theoretical point that the "filename" is obviously part of the data in the tree, and as such, a similarity comparison that takes only the data into account is a bit limited. So while I don't think a user should really care, I also think that keeping the filename as part of the similarity analysis is actually a perfectly logical and valid thing to do withing the git policy of "content is king".

The filename *is* part of the content, and it's doubly so when you think about a rename or copy operation, where the whole point of the exercise is as much about the filename as about the data inside the file.

			Linus
Previous: Johannes SchindelinNext: Junio C Hamano
Message 21 of 44 in “Basename matching during rename/copy detection”
  1. Shawn O. PearceJun 21, 2007
  2. Junio C HamanoJun 21, 2007
  3. Andy ParkinsJun 21, 2007
  4. Junio C HamanoJun 21, 2007
  5. Andy ParkinsJun 21, 2007
  6. Johannes SchindelinJun 21, 2007
  7. Andy ParkinsJun 21, 2007
  8. Matthieu MoyJun 21, 2007
  9. Jeff KingJun 21, 2007
  10. Johannes SchindelinJun 21, 2007
  11. Matthieu MoyJun 21, 2007
  12. Johannes SchindelinJun 21, 2007
  13. Steven GrimmJun 21, 2007
  14. Johannes SchindelinJun 21, 2007
  15. Steven GrimmJun 21, 2007
  16. Johannes SchindelinJun 21, 2007
  17. Linus TorvaldsJun 21, 2007
  18. diffcore-rename: favour identical basenamesJohannes Schindelin, Jun 21, 2007
  19. Jeff KingJun 21, 2007
  20. Johannes SchindelinJun 21, 2007
  21. Linus TorvaldsJun 21, 2007
  22. Junio C HamanoJun 21, 2007
  23. Linus TorvaldsJun 21, 2007
  24. Andy ParkinsJun 22, 2007
  25. Johannes SchindelinJun 22, 2007
  26. Aidan Van DykJun 22, 2007
  27. Johannes SchindelinJun 22, 2007
  28. Jeff KingJun 22, 2007
  29. Johannes SchindelinJun 22, 2007
  30. Johannes SixtJun 22, 2007
  31. Johannes SchindelinJun 22, 2007
  32. 100% (was: [PATCH] diffcore-rename: favour identical basenames)David Kastrup, Jun 22, 2007
  33. Johannes SchindelinJun 22, 2007
  34. Junio C HamanoJun 23, 2007
  35. Johannes SchindelinJun 23, 2007
  36. René ScharfeJun 23, 2007
  37. Johannes SchindelinJun 23, 2007
  38. René ScharfeJun 23, 2007
  39. Johannes SchindelinJun 23, 2007
  40. René ScharfeJun 23, 2007
  41. Johannes SchindelinJun 23, 2007
  42. René ScharfeJun 24, 2007
  43. Junio C HamanoJun 23, 2007
  44. Johannes SchindelinJun 23, 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.