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

Re: Two bugs with renaming

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 20, 2008, 04:45 UTC
Message-ID
<7vbq5aypdq.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LFD.1.00.0803192059120.3020@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 5 quoted lines
> Now, arguably, it should just see them as two independent issues, and then 
> the rename detection will notice that the "files/delete.me" file got 
> renamed as "files.upstream/delete.me", so *after* rename detection there 
> will be no D/F conflict in the end result, but we see the conflict before 
> that all even happens.
The common ancestor had files/delete.me.

Our side (test_branch) deleted files/delete.me, created files.upstream/delete.me and created files.

Their side (master)kept files/delete.me without changing, created foo.
So I would think we should not even trigger D/F conflict at all.
 - files/delete.me is deleted by only one side (our side) and it should go.
 - files and files.upstream/delete.me are created by only one side (ours)
   and it should stay.
 - foo is created by only one side (theirs) and it should come.

However, we wanted to allow policy decision to happen after read-tree, and we traditionally kept "one side removes" case as an internal conflict in the index, later to be resolved by merge-one-file (and merge-recursive).

So I think the resulting index should look like this:
        100644 xxxxxxx 0	files.upstream/delete.me
        100644 xxxxxxx 1	files/delete.me
        100644 xxxxxxx 3	files/delete.me
        120000 xxxxxxx 0	files
        100644 xxxxxxx 0	foo

or (if we also want to leave policy decision for "one side adds" case to merge-one-file and merge-recursive) even:

        100644 xxxxxxx 1	files/delete.me
        100644 xxxxxxx 3	files/delete.me
        120000 xxxxxxx 2	files
        100644 xxxxxxx 2	files.upstream/delete.me
        100644 xxxxxxx 2	foo

But that is not what is happening here. In fact, if you did not have "files" in the test branch, here is what you will see:

        100644 xxxxxxx 0	files.upstream/delete.me
        100644 xxxxxxx 1	files/delete.me
        100644 xxxxxxx 3	files/delete.me
        100644 xxxxxxx 0	foo

and merge-recursive knows how to match up the first three entries and if there are changes between stages #1 and #3 of files/delete.me, that is carried forward to files.upstream/delete.me

Your unpack_trees() is bug-to-bug compatibile with Daniel's that is in 1.5.4. Both "read-tree -m -u" bails out with the same error, without even leaving higher stage entries in the index.

Previous: Linus Torvalds
Message 9 of 9 in “Two bugs with renaming”
  1. John GoerzenMar 19, 2008
  2. Junio C HamanoMar 20, 2008
  3. Jeff KingMar 20, 2008
  4. John GoerzenMar 20, 2008
  5. Jeff KingMar 20, 2008
  6. Björn SteinbrinkMar 20, 2008
  7. Linus TorvaldsMar 20, 2008
  8. Linus TorvaldsMar 20, 2008
  9. Junio C HamanoMar 20, 2008

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.