summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 22da742)
raw | patch | inline | side by side (parent: 22da742)
author | Schalk, Ken <ken.schalk@intel.com> | |
Wed, 1 Sep 2010 20:15:32 +0000 (13:15 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 3 Sep 2010 18:26:49 +0000 (11:26 -0700) |
>Due to this this (and maybe all the tests) need to depend on the
>SYMLINKS prereq.
Here's a third attempt with no use of symlinks in the test:
Skip the entire rename/add conflict case if the file added on the
other branch has the same contents as the file being renamed. This
avoids giving the user an extra copy of the same file and presenting a
conflict that is confusing and pointless.
A simple test of this case has been added in
t/t3030-merge-recursive.sh.
Signed-off-by: Ken Schalk <ken.schalk@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
>SYMLINKS prereq.
Here's a third attempt with no use of symlinks in the test:
Skip the entire rename/add conflict case if the file added on the
other branch has the same contents as the file being renamed. This
avoids giving the user an extra copy of the same file and presenting a
conflict that is confusing and pointless.
A simple test of this case has been added in
t/t3030-merge-recursive.sh.
Signed-off-by: Ken Schalk <ken.schalk@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c | patch | blob | history | |
t/t3030-merge-recursive.sh | patch | blob | history |
diff --git a/merge-recursive.c b/merge-recursive.c
index fb6aa4a551802de07be76bd838b6f22a236457ff..a2fba84d9d3d1aab5deb10ff1074b065b2a54047 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
ren1->pair->two : NULL,
branch1 == o->branch1 ?
NULL : ren1->pair->two, 1);
+ } else if ((dst_other.mode == ren1->pair->two->mode) &&
+ sha_eq(dst_other.sha1, ren1->pair->two->sha1)) {
+ /* Added file on the other side
+ identical to the file being
+ renamed: clean merge */
+ update_file(o, 1, ren1->pair->two->sha1, ren1->pair->two->mode, ren1_dst);
} else if (!sha_eq(dst_other.sha1, null_sha1)) {
const char *new_path;
clean_merge = 0;
index d541544537d47587abad8d27565cf9197387cfd6..df234f144a5f72c85f95ec6d3c218f70eebecfc8 100755 (executable)
git branch df-3 &&
git branch remove &&
git branch submod &&
+ git branch copy &&
+ git branch rename &&
echo hello >>a &&
cp a d/e &&
git commit -m "make d/ a submodule"
'
+test_expect_success 'setup 8' '
+ git checkout rename &&
+ git mv a e &&
+ git add e &&
+ test_tick &&
+ git commit -m "rename a->e"
+'
+
+test_expect_success 'setup 9' '
+ git checkout copy &&
+ cp a e &&
+ git add e &&
+ test_tick &&
+ git commit -m "copy a->e"
+'
+
test_expect_success 'merge-recursive simple' '
rm -fr [abcd] &&
test_cmp expected actual
'
+test_expect_success 'merge-recursive copy vs. rename' '
+ git checkout -f copy &&
+ git merge rename &&
+ ( git ls-tree -r HEAD && git ls-files -s ) >actual &&
+ (
+ echo "100644 blob $o0 b"
+ echo "100644 blob $o0 c"
+ echo "100644 blob $o0 d/e"
+ echo "100644 blob $o0 e"
+ echo "100644 $o0 0 b"
+ echo "100644 $o0 0 c"
+ echo "100644 $o0 0 d/e"
+ echo "100644 $o0 0 e"
+ ) >expected &&
+ test_cmp expected actual
+'
+
test_done