Re: Two bugs with renaming
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:24
Linus Torvalds [off-list ref] writes:
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.