Merge branch 'ja/doc-synopsis-markup'
[git/gitster.git] / t / t7615-diff-algo-with-mergy-operations.sh
blob9a83be518cb73b81d379c1e941c4ca55b1e67914
1 #!/bin/sh
3 test_description='git merge and other operations that rely on merge
5 Testing the influence of the diff algorithm on the merge output.'
7 TEST_PASSES_SANITIZE_LEAK=true
8 . ./test-lib.sh
10 test_expect_success 'setup' '
11 cp "$TEST_DIRECTORY"/t7615/base.c file.c &&
12 git add file.c &&
13 git commit -m c0 &&
14 git tag c0 &&
15 cp "$TEST_DIRECTORY"/t7615/ours.c file.c &&
16 git add file.c &&
17 git commit -m c1 &&
18 git tag c1 &&
19 git reset --hard c0 &&
20 cp "$TEST_DIRECTORY"/t7615/theirs.c file.c &&
21 git add file.c &&
22 git commit -m c2 &&
23 git tag c2
26 GIT_TEST_MERGE_ALGORITHM=recursive
28 test_expect_success 'merge c2 to c1 with recursive merge strategy fails with the current default myers diff algorithm' '
29 git reset --hard c1 &&
30 test_must_fail git merge -s recursive c2
33 test_expect_success 'merge c2 to c1 with recursive merge strategy succeeds with -Xdiff-algorithm=histogram' '
34 git reset --hard c1 &&
35 git merge --strategy recursive -Xdiff-algorithm=histogram c2
38 test_expect_success 'merge c2 to c1 with recursive merge strategy succeeds with diff.algorithm = histogram' '
39 git reset --hard c1 &&
40 git config diff.algorithm histogram &&
41 git merge --strategy recursive c2
44 test_expect_success 'cherry-pick c2 to c1 with recursive merge strategy fails with the current default myers diff algorithm' '
45 git reset --hard c1 &&
46 test_must_fail git cherry-pick -s recursive c2
49 test_expect_success 'cherry-pick c2 to c1 with recursive merge strategy succeeds with -Xdiff-algorithm=histogram' '
50 git reset --hard c1 &&
51 git cherry-pick --strategy recursive -Xdiff-algorithm=histogram c2
54 test_expect_success 'cherry-pick c2 to c1 with recursive merge strategy succeeds with diff.algorithm = histogram' '
55 git reset --hard c1 &&
56 git config diff.algorithm histogram &&
57 git cherry-pick --strategy recursive c2
60 test_done