]> git.ipfire.org Git - thirdparty/git.git/blame - t/t7605-merge-resolve.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t7605-merge-resolve.sh
CommitLineData
3f4d1c63
MV
1#!/bin/sh
2
47a528ad 3test_description='git merge
3f4d1c63
MV
4
5Testing the resolve strategy.'
6
e84a26e3 7TEST_PASSES_SANITIZE_LEAK=true
3f4d1c63
MV
8. ./test-lib.sh
9
10test_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
29'
30
ef7d3621 31merge_c1_to_c2_cmds='
3f4d1c63
MV
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 &&
446247db
JH
40 test -f c2.c &&
41 test 3 = $(git ls-tree -r HEAD | wc -l) &&
42 test 3 = $(git ls-files | wc -l)
3f4d1c63
MV
43'
44
ef7d3621
EN
45test_expect_success 'merge c1 to c2' "$merge_c1_to_c2_cmds"
46
40d71940 47test_expect_success 'merge c1 to c2, again' "$merge_c1_to_c2_cmds"
ef7d3621 48
3f4d1c63
MV
49test_expect_success 'merge c2 to c3 (fails)' '
50 git reset --hard c2 &&
51 test_must_fail git merge -s resolve c3
52'
53test_done