summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 32192e6)
raw | patch | inline | side by side (parent: 32192e6)
author | Junio C Hamano <junkio@cox.net> | |
Sat, 11 Jun 2005 09:53:57 +0000 (02:53 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Mon, 13 Jun 2005 03:40:20 +0000 (20:40 -0700) |
This patch teaches read-tree 3-way merge that, when only "the
other tree" changed a path, and if the index file already has
the same change, we are not in a situation that would clobber
the index and the work tree, and lets the merge succeed; this is
case #14ALT in t1000 test. It does not change the result of the
merge, but prevents it from failing when it does not have to.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
other tree" changed a path, and if the index file already has
the same change, we are not in a situation that would clobber
the index and the work tree, and lets the merge succeed; this is
case #14ALT in t1000 test. It does not change the result of the
merge, but prevents it from failing when it does not have to.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
read-tree.c | patch | blob | history | |
t/t1000-read-tree-m-3way.sh | patch | blob | history |
diff --git a/read-tree.c b/read-tree.c
index d86cc0263c7d2e23aa88b387b1cf040e1c06d6bc..0d94fe214d4fd7b24b00f419097f79dab4889670 100644 (file)
--- a/read-tree.c
+++ b/read-tree.c
}
/* 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
index 3d9b3ac9b0d8f6a4ea8459be943439f333ba5bd1..89f0e81f2335e4ade732a22789d8bb1b1a13e908 100755 (executable)
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 &&