]>
Commit | Line | Data |
---|---|---|
c23fc075 EN |
1 | #!/bin/sh |
2 | ||
3 | test_description="Test that merge state is as expected after failed merge" | |
4 | ||
5 | GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main | |
6 | export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME | |
716a6b2c | 7 | TEST_PASSES_SANITIZE_LEAK=true |
c23fc075 EN |
8 | . ./test-lib.sh |
9 | ||
10 | test_expect_success 'Ensure we restore original state if no merge strategy handles it' ' | |
11 | test_commit --no-tag "Initial" base base && | |
12 | ||
13 | for b in branch1 branch2 branch3 | |
14 | do | |
15 | git checkout -b $b main && | |
16 | test_commit --no-tag "Change on $b" base $b || return 1 | |
17 | done && | |
18 | ||
19 | git checkout branch1 && | |
20 | # This is a merge that octopus cannot handle. Note, that it does not | |
21 | # just hit conflicts, it completely fails and says that it cannot | |
22 | # handle this type of merge. | |
23 | test_expect_code 2 git merge branch2 branch3 >output 2>&1 && | |
24 | grep "fatal: merge program failed" output && | |
25 | grep "Should not be doing an octopus" output && | |
26 | ||
27 | # Make sure we did not leave stray changes around when no appropriate | |
28 | # merge strategy was found | |
29 | git diff --exit-code --name-status && | |
30 | test_path_is_missing .git/MERGE_HEAD | |
31 | ' | |
32 | ||
33 | test_done |