]> git.ipfire.org Git - thirdparty/git.git/commitdiff
merge-tree: fix typo in "both changed identically"
authorJohn Keeping <john@keeping.me.uk>
Sat, 27 Apr 2013 13:40:33 +0000 (14:40 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 28 Apr 2013 18:53:41 +0000 (11:53 -0700)
Commit aacecc3 (merge-tree: don't print entries that match "local" -
2013-04-07) had a typo causing the "same in both" check to be incorrect
and check if both the base and "their" versions are removed instead of
checking that both the "our" and "their" versions are removed.  Fix
this.

Reported-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Test-written-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/merge-tree.c
t/t4300-merge-tree.sh

index ed25d81b880eb830481d4e729d7e9acc3266de65..ec49917a3686233548afb0f959208e2561fc1374 100644 (file)
@@ -302,7 +302,7 @@ static void unresolved(const struct traverse_info *info, struct name_entry n[3])
 static int threeway_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *info)
 {
        /* Same in both? */
-       if (same_entry(entry+1, entry+2) || both_empty(entry+0, entry+2)) {
+       if (same_entry(entry+1, entry+2) || both_empty(entry+1, entry+2)) {
                /* Modified, added or removed identically */
                resolve(info, NULL, entry+1);
                return mask;
index bd43b3d8ef8b3e71f6985cfa96a940dccb4a0a54..2defb422e8813c1ca314939aedba1d33c40dd388 100755 (executable)
@@ -205,6 +205,19 @@ EXPECTED
        test_cmp expected actual
 '
 
+test_expect_success 'file remove A, B (same)' '
+       cat >expected <<\EXPECTED &&
+EXPECTED
+
+       git reset --hard initial &&
+       test_commit "rm-a-b-base" "ONE" "AAA" &&
+       git rm ONE &&
+       git commit -m "rm-a-b" &&
+       git tag "rm-a-b" &&
+       git merge-tree rm-a-b-base rm-a-b rm-a-b >actual &&
+       test_cmp expected actual
+'
+
 test_expect_success 'file change A, remove B' '
        cat >expected <<\EXPECTED &&
 removed in remote