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

Re: Following renames

From
Petr Baudis <pasky@suse.cz>
Date
Mar 26, 2006, 10:52 UTC
Message-ID
<20060326105248.GG18185@pasky.or.cz>
In-Reply-To
<7virq1sywj.fsf@assigned-by-dhcp.cox.net>

(Note that I do *not* want to raise the explicit vs. implicit rename tracking argument, in case anyone would misunderstood. I've accepted implicit rename tracking as a fact of Git life for now. I just want to make use of it now. ;-)

Dear diary, on Sun, Mar 26, 2006 at 04:49:48AM CEST, I got a letter where Junio C Hamano <junkio@cox.net> said that...

> Looking at the evolution of rev-list.c file itself was a good
> exercise to realize that rename tracking (more specifically,
> having whatchanged to follow renames) is not such a useful
> thing (at least for me).

Well, noone argues that rename tracking cures all the woes of hackerkind and anything more precise than that is useless. I'm rather saying that rename tracking indeed _is_ a special case of something more general and truly very interesting, but a special case so frequent that it's worth doing even if we can't do the general case yet. Or at least people *think* it's very frequent and it gives them the warm fuzzy feeling knowing that the tool can handle it (at least somehow) - and the warm fuzzy feeling is important, especially if you're trusting your sources to the tool.

So, obviously, you'll find plenty of counter-examples where rename detection won't help. I don't argue that. I merely say that there will still be enough cases where following renames will help to warrant doing it.

Now, Git history has enough examples of where rename following would be useful. When I'm digging into the history, I'm hitting the big tools rename barrier all the time, and just yesterday when wondering about jdl's <snap> removal from git.txt I've hit 2cf565c53 - coming along any file to that commit should make me follow Documentation/core-git.txt out of the commit (well, that's rather copy than rename detection).

Show 7 quoted lines
> Another example.  Today's tar-tree updates have one interesting
> function I think should belong to strbuf.c, and before merging
> it to the mainline, I may move that function from tar-tree.c to
> strbuf.c.  After that happens, if I run "whatchanged strbuf.c"
> to see where that function came from, I would want it to notice
> it came from tar-tree.c, although it is not a rename at all.
> Just one function moved from a file to another.

A wild pickaxe - when the string disappears from file X, scan all the changes in the commit and start following files where it reappears. This should help, right?

But when you want to implement this, you hit the exact same problems as when you try to follow renames, only a different part of diffcore detects it. So, what I'm trying to solve is actually not just following renames but a more general problem.

> If a file A and file B were cleaned up and merged into a single file
> C, which is in the tip of the tree, which one you would want
> whatchanged to switch following depends on which part of the C you
> were interested in.

If in doubt (and the user does not use pickaxe to clarify it), you can just follow both. The user will get some extra stuff (or maybe even not if he wants to know about pieces from both), but we are at least trying to be useful and DTRT instead of doing nothing in case we would by any chance not do the very best.

> Unless you are interested in the _entire_ contents of the file,
> that is.  Then tracking or even recording renames becomes
> useful, but that is a special case.
A frequent (and wanted) special case.
> That is the reason I am not so enthused about recording renames.
> I think the time is better spent on enhancing what pickaxe tries
> to do (currently it does very little), which I hinted in a
> separate message late last night.

Sure, pickaxe is cool, but as I said above, if you try to teach _it_ following around files, you'll hit the exact same problems as me. We're just trying to build something using lego blocks with different stuff inside but otherwise actually looking pretty much the same.

The thing with pickaxe is that frequently it would be simply more laborous to dig for and construct the proper pickaxe string than just firing up cg-log -s filename with greedy renames following and quickly scanning through the results.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.
Previous: Paul JakmaNext: Petr Baudis
Message 5 of 41 in “Following renames”
  1. Petr BaudisMar 26, 2006
  2. Junio C HamanoMar 26, 2006
  3. Jakub NarebskiMar 26, 2006
  4. Paul JakmaMar 27, 2006
  5. Petr BaudisMar 26, 2006
  6. Petr BaudisMar 26, 2006
  7. Timo HirvonenMar 26, 2006
  8. Linus TorvaldsMar 26, 2006
  9. Jakub NarebskiMar 26, 2006
  10. Linus TorvaldsMar 26, 2006
  11. Jakub NarebskiMar 26, 2006
  12. Linus TorvaldsMar 26, 2006
  13. Marco CostalbaMar 26, 2006
  14. Linus TorvaldsMar 26, 2006
  15. Marco CostalbaMar 27, 2006
  16. Junio C HamanoMar 27, 2006
  17. Linus TorvaldsMar 27, 2006
  18. Marco CostalbaMar 27, 2006
  19. Johannes SchindelinMar 27, 2006
  20. Linus TorvaldsMar 27, 2006
  21. Marco CostalbaMar 27, 2006
  22. Andreas EricssonMar 27, 2006
  23. Jakub NarebskiMar 27, 2006
  24. David LangMar 27, 2006
  25. Jakub NarebskiMar 27, 2006
  26. Linus TorvaldsMar 26, 2006
  27. Ryan AndersonMar 26, 2006
  28. Petr BaudisMar 26, 2006
  29. Fredrik KuivinenMar 26, 2006
  30. Linus TorvaldsMar 26, 2006
  31. Petr BaudisMar 26, 2006
  32. Petr BaudisMar 26, 2006
  33. Linus TorvaldsMar 26, 2006
  34. Petr BaudisMar 26, 2006
  35. Junio C HamanoMar 26, 2006
  36. Linus TorvaldsMar 26, 2006
  37. Junio C HamanoMar 27, 2006
  38. Linus TorvaldsMar 26, 2006
  39. Petr BaudisMar 26, 2006
  40. Petr BaudisMar 27, 2006
  41. Petr BaudisMar 26, 2006

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.