commit-reach(paint_down_to_common): plug two memory leaks
[git.git] / t / t7605-merge-resolve.sh
blob62d935d31c2e1dc9cbca3779407b6b86bc5ce4c5
1 #!/bin/sh
3 test_description='git merge
5 Testing the resolve strategy.'
7 TEST_PASSES_SANITIZE_LEAK=true
8 . ./test-lib.sh
10 test_expect_success 'setup' '
11 echo c0 > c0.c &&
12 git add c0.c &&
13 git commit -m c0 &&
14 git tag c0 &&
15 echo c1 > c1.c &&
16 git add c1.c &&
17 git commit -m c1 &&
18 git tag c1 &&
19 git reset --hard c0 &&
20 echo c2 > c2.c &&
21 git add c2.c &&
22 git commit -m c2 &&
23 git tag c2 &&
24 git reset --hard c0 &&
25 echo c3 > c2.c &&
26 git add c2.c &&
27 git commit -m c3 &&
28 git tag c3
31 merge_c1_to_c2_cmds='
32 git reset --hard c1 &&
33 git merge -s resolve c2 &&
34 test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
35 test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&
36 test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&
37 git diff --exit-code &&
38 test -f c0.c &&
39 test -f c1.c &&
40 test -f c2.c &&
41 test 3 = $(git ls-tree -r HEAD | wc -l) &&
42 test 3 = $(git ls-files | wc -l)
45 test_expect_success 'merge c1 to c2' "$merge_c1_to_c2_cmds"
47 test_expect_success 'merge c1 to c2, again' "$merge_c1_to_c2_cmds"
49 test_expect_success 'merge c2 to c3 (fails)' '
50 git reset --hard c2 &&
51 test_must_fail git merge -s resolve c3
53 test_done