diff options
-rw-r--r-- | read-tree.c | 6 | ||||
-rwxr-xr-x | t/t1000-read-tree-m-3way.sh | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/read-tree.c b/read-tree.c index d86cc0263c..0d94fe214d 100644 --- a/read-tree.c +++ b/read-tree.c @@ -280,6 +280,12 @@ static int threeway_merge(struct cache_entry *stages[4], } /* otherwise we will apply the original rule */ } + /* #14ALT */ + if (a && b && c && same(a, b) && !same(a, c)) { + if (old && same(old, c)) + return merged_entry_allow_dirty(c, old, dst); + /* otherwise the regular rule applies */ + } /* * If we have an entry in the index cache ("old"), then we want * to make sure that it matches any entries in stage 2 ("first diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh index 3d9b3ac9b0..89f0e81f23 100755 --- a/t/t1000-read-tree-m-3way.sh +++ b/t/t1000-read-tree-m-3way.sh @@ -464,6 +464,15 @@ test_expect_success \ git-read-tree -m $tree_O $tree_A $tree_B && check_result" +test_expect_success \ + '14 - may match B in O && A && B && O==A && O!=B case' \ + "rm -f .git/index NM && + cp .orig-B/NM NM && + git-update-cache --add NM && + echo extra >>NM && + git-read-tree -m $tree_O $tree_A $tree_B && + check_result" + test_expect_failure \ '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' \ "rm -f .git/index NM && |