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

Re: On recording renames

From
Junio C Hamano <junkio@cox.net>
Date
Mar 4, 2006, 06:16 UTC
Message-ID
<7v64muvin9.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vfylyx3e3.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
Show 21 quoted lines
>
>        a1--a2--a3--a4--a5--A
>       /                     \
>   ---O---b1--b2--b3--b4--B---* 
>
>     O has hello.c
>     a1 renames file hello.c to world.c and a2-a5-A modifies world.c
>     b1-b4-B modifies hello.c 
>     we are about to merge A and B
>
>     comparing O and A may not notice O's hello.c and A's world.c
>     are similar!
>
> But you are allowed to write a new merge strategy that is more
> careful about renames.  There is no reason you can only look at
> three trees.  Such a merge strategy, when given commit A and B,
> would walk the history back, running "diff-tree -M" for each
> commit along the way, and difference between O's hello.c and
> a1's world.c would be hopefully *much* smaller than O's hello.c
> and A's world.c -- even the current similarity estimator may
> recognize it is a rename.

A bit more on merges and renames. The thread that started on Dec 16 2005 by Don Zickus is about a case that anybody interested in renaming merge should think about. Unfortunately gmane web interface says it is "down for maintenance" so I cannot give an URL, but the message IDs of key messages are:

        <68948ca0512161205x3d5921bfm3bfcaa64f988eb99@mail.gmail.com>
        <7vbqzgbcyv.fsf@assigned-by-dhcp.cox.net>
The whole thread is worth reading, but the punch line is:
        The transition happened over time with multiple commits.
        You cannot record "this is the rename" by attributing that
        information to one particular commit.
Previous: Paul JakmaNext: Junio C Hamano
Message 3 of 5 in “On recording renames”
  1. Junio C HamanoMar 4, 2006
  2. Paul JakmaMar 4, 2006
  3. Junio C HamanoMar 4, 2006
  4. Junio C HamanoMar 4, 2006
  5. Linus TorvaldsMar 4, 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.