aboutsummaryrefslogtreecommitdiff
path: root/t/t1000-read-tree-m-3way.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-06-10 18:37:47 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-12 20:40:20 -0700
commite7f9bc411c8519468c33e1d882fb02cbe9c1ea55 (patch)
tree9085834cbda44fd94b4a1e9133f60af7872deea6 /t/t1000-read-tree-m-3way.sh
parent03efa6d9a4c974c502dbad457749ad316aac9cc6 (diff)
downloadgit-e7f9bc411c8519468c33e1d882fb02cbe9c1ea55.tar.gz
git-e7f9bc411c8519468c33e1d882fb02cbe9c1ea55.tar.xz
[PATCH] read-tree: fix too strong index requirement #5ALT
This fixes too strong index requirement 3-way merge enforces in one case: the same file is added in both branches. In this case, the original code insisted that if the index file has that path, it must match our branch and be up-to-date. However in this particular case, it only has to match it, and can be dirty. We just need to make sure that we keep the work-tree copy instead of checking out the merge result. The resolution of such a path, however, cannot be left to outside script, because we will not keep the original stage0 entries for unmerged paths when read-tree finishes, and at that point, the knowledge of "if we resolve it to match the new file added in both branches, the merge succeeds and the work tree would not lose information, but we should _not_ update the work tree from the resulting index file" is lost. For this reason, the now code needs to resolve this case (#5ALT) internally. This affects some existing tests in the test suite, but all in positive ways. In t1000 (3-way test), this #5ALT case now gets one stage0 entry, instead of an identical stage2 and stage3 entry pair, for such a path, and one test that checked for merge failure (because the test assumed the "stricter-than-necessary" behaviour) does not have to fail anymore. In t1005 (emu23 test), two tests that involves a case where the work tree already had a change introduced in the upstream (aka "merged head"), the merge succeeds instead of failing. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 't/t1000-read-tree-m-3way.sh')
-rwxr-xr-xt/t1000-read-tree-m-3way.sh17
1 files changed, 9 insertions, 8 deletions
diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh
index c43588727..92833fe95 100755
--- a/t/t1000-read-tree-m-3way.sh
+++ b/t/t1000-read-tree-m-3way.sh
@@ -75,7 +75,8 @@ In addition:
. ../lib-read-tree-m-3way.sh
################################################################
-# This is the "no trivial merge unless all three exists" table.
+# Trivial "majority when 3 stages exist" merge plus #5ALT trivial
+# merge.
cat >expected <<\EOF
100644 X 2 AA
@@ -88,8 +89,7 @@ cat >expected <<\EOF
100644 X 3 DM
100644 X 1 DN
100644 X 3 DN
-100644 X 2 LL
-100644 X 3 LL
+100644 X 0 LL
100644 X 1 MD
100644 X 2 MD
100644 X 1 MM
@@ -289,23 +289,24 @@ test_expect_failure \
git-read-tree -m $tree_O $tree_A $tree_B"
test_expect_success \
- '5 - must match and be up-to-date in !O && A && B && A==B case.' \
+ '5 - must match in !O && A && B && A==B case.' \
"rm -f .git/index LL &&
cp .orig-A/LL LL &&
git-update-cache --add LL &&
git-read-tree -m $tree_O $tree_A $tree_B &&
check_result"
-test_expect_failure \
- '5 (fail) - must match and be up-to-date in !O && A && B && A==B case.' \
+test_expect_success \
+ '5 - must match in !O && A && B && A==B case.' \
"rm -f .git/index LL &&
cp .orig-A/LL LL &&
git-update-cache --add LL &&
echo extra >>LL &&
- git-read-tree -m $tree_O $tree_A $tree_B"
+ git-read-tree -m $tree_O $tree_A $tree_B &&
+ check_result"
test_expect_failure \
- '5 (fail) - must match and be up-to-date in !O && A && B && A==B case.' \
+ '5 (fail) - must match A in !O && A && B && A==B case.' \
"rm -f .git/index LL &&
cp .orig-A/LL LL &&
echo extra >>LL &&