Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2010-09-20 12:28:44 +0400
committerJunio C Hamano <gitster@pobox.com>2010-09-30 04:32:37 +0400
commitc976260d0f3d3f99dc3594e3f98436bfd920dc97 (patch)
tree954c085342faae21fde61dd6c9e73c23134bbf95 /t/t6036-recursive-corner-cases.sh
parentfa0ae3b1ddeeb8c872f3804950fa95b5fc8b4138 (diff)
t6036: Test index and worktree state, not just that merge fails
c94736a (merge-recursive: don't segfault while handling rename clashes 2009-07-30) added this testcase with an interesting corner case test, which previously had cased git to segfault. This test ensures that the segfault does not return and that the merge correctly fails; just add some checks that verify the state of the index and worktree after the merge are correct. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6036-recursive-corner-cases.sh')
-rwxr-xr-xt/t6036-recursive-corner-cases.sh24
1 files changed, 21 insertions, 3 deletions
diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index b874141658..1755073735 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -14,7 +14,7 @@ test_description='recursive merge corner cases'
# R1 R2
#
-test_expect_success setup '
+test_expect_success 'setup basic criss-cross + rename with no modifications' '
ten="0 1 2 3 4 5 6 7 8 9"
for i in $ten
do
@@ -45,11 +45,29 @@ test_expect_success setup '
git tag R2
'
-test_expect_success merge '
+test_expect_success 'merge simple rename+criss-cross with no modifications' '
git reset --hard &&
git checkout L2^0 &&
- test_must_fail git merge -s recursive R2^0
+ test_must_fail git merge -s recursive R2^0 &&
+
+ test 5 = $(git ls-files -s | wc -l) &&
+ test 3 = $(git ls-files -u | wc -l) &&
+ test 0 = $(git ls-files -o | wc -l) &&
+
+ test $(git rev-parse :0:one) = $(git rev-parse L2:one) &&
+ test $(git rev-parse :0:two) = $(git rev-parse R2:two) &&
+ test $(git rev-parse :2:three) = $(git rev-parse L2:three) &&
+ test $(git rev-parse :3:three) = $(git rev-parse R2:three) &&
+
+ cp two merged &&
+ >empty &&
+ test_must_fail git merge-file \
+ -L "Temporary merge branch 2" \
+ -L "" \
+ -L "Temporary merge branch 1" \
+ merged empty one &&
+ test $(git rev-parse :1:three) = $(git hash-object merged)
'
test_done