path: root/t/
diff options
authorJunio C Hamano <>2005-06-11 01:37:47 (GMT)
committerLinus Torvalds <>2005-06-13 03:40:20 (GMT)
commite7f9bc411c8519468c33e1d882fb02cbe9c1ea55 (patch)
tree9085834cbda44fd94b4a1e9133f60af7872deea6 /t/
parent03efa6d9a4c974c502dbad457749ad316aac9cc6 (diff)
[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 <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 't/')
1 files changed, 4 insertions, 5 deletions
diff --git a/t/ b/t/
index 3345c9d..495642e 100644
--- a/t/
+++ b/t/
@@ -117,9 +117,8 @@ test_expect_success \
check_cache_at yomin dirty'
# "read-tree -m H I+H M" where !H && M && (I+H) == M, so this should
-# succeed (even the entry is clean), but without #5ALT this does not
-# work.
-: test_expect_success \
+# succeed (even the entry is clean), now thanks to #5ALT.
+test_expect_success \
'6 - local addition already has the same.' \
'rm -f .git/index &&
git-update-cache --add frotz &&
@@ -129,8 +128,8 @@ test_expect_success \
check_cache_at frotz clean'
# Exactly the same pattern as above but with dirty cache. This also
-# should succeed, but without #5ALT it does not.
-: test_expect_success \
+# should succeed, now thanks to #5ALT.
+test_expect_success \
'7 - local addition already has the same.' \
'rm -f .git/index &&
echo frotz >frotz &&