]>
Commit | Line | Data |
---|---|---|
1b1d78fe MV |
1 | #!/bin/sh |
2 | ||
f964732c | 3 | test_description='git merge |
1b1d78fe MV |
4 | |
5 | Testing a custom strategy.' | |
6 | ||
7 | . ./test-lib.sh | |
8 | ||
9 | cat >git-merge-theirs <<EOF | |
10 | #!$SHELL_PATH | |
11 | eval git read-tree --reset -u \\\$\$# | |
12 | EOF | |
13 | chmod +x git-merge-theirs | |
14 | PATH=.:$PATH | |
15 | export PATH | |
16 | ||
17 | test_expect_success 'setup' ' | |
18 | echo c0 >c0.c && | |
19 | git add c0.c && | |
20 | git commit -m c0 && | |
21 | git tag c0 && | |
22 | echo c1 >c1.c && | |
23 | git add c1.c && | |
24 | git commit -m c1 && | |
25 | git tag c1 && | |
26 | git reset --hard c0 && | |
e596cddd | 27 | echo c1c1 >c1.c && |
1b1d78fe | 28 | echo c2 >c2.c && |
e596cddd | 29 | git add c1.c c2.c && |
1b1d78fe MV |
30 | git commit -m c2 && |
31 | git tag c2 | |
32 | ' | |
33 | ||
34 | test_expect_success 'merge c2 with a custom strategy' ' | |
35 | git reset --hard c1 && | |
36 | git merge -s theirs c2 && | |
37 | test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" && | |
38 | test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" && | |
39 | test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" && | |
40 | test "$(git rev-parse c2^{tree})" = "$(git rev-parse HEAD^{tree})" && | |
41 | git diff --exit-code && | |
e596cddd JH |
42 | git diff --exit-code c2 HEAD && |
43 | git diff --exit-code c2 && | |
1b1d78fe | 44 | test -f c0.c && |
e596cddd | 45 | grep c1c1 c1.c && |
1b1d78fe MV |
46 | test -f c2.c |
47 | ' | |
48 | ||
49 | test_done |