Skip to content

Commit ab5f424

Browse files
johnkeepinggitster
authored andcommitted
merge-tree: fix typo in "both changed identically"
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 <[email protected]> Test-written-by: René Scharfe <[email protected]> Signed-off-by: John Keeping <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aacecc3 commit ab5f424

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

builtin/merge-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ static void unresolved(const struct traverse_info *info, struct name_entry n[3])
302302
static int threeway_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *info)
303303
{
304304
/* Same in both? */
305-
if (same_entry(entry+1, entry+2) || both_empty(entry+0, entry+2)) {
305+
if (same_entry(entry+1, entry+2) || both_empty(entry+1, entry+2)) {
306306
/* Modified, added or removed identically */
307307
resolve(info, NULL, entry+1);
308308
return mask;

t/t4300-merge-tree.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,19 @@ EXPECTED
205205
test_cmp expected actual
206206
'
207207

208+
test_expect_success 'file remove A, B (same)' '
209+
cat >expected <<\EXPECTED &&
210+
EXPECTED
211+
212+
git reset --hard initial &&
213+
test_commit "rm-a-b-base" "ONE" "AAA" &&
214+
git rm ONE &&
215+
git commit -m "rm-a-b" &&
216+
git tag "rm-a-b" &&
217+
git merge-tree rm-a-b-base rm-a-b rm-a-b >actual &&
218+
test_cmp expected actual
219+
'
220+
208221
test_expect_success 'file change A, remove B' '
209222
cat >expected <<\EXPECTED &&
210223
removed in remote

0 commit comments

Comments
 (0)