interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t7615-diff-algo-with-mergy-operations.sh

57 lines · 1814 bytes Raw Blame History
1#!/bin/sh
2
3test_description='git merge and other operations that rely on merge
4
5Testing the influence of the diff algorithm on the merge output.'
6
7. ./test-lib.sh
8
9test_expect_success 'setup' '
10 cp "$TEST_DIRECTORY"/t7615/base.c file.c &&
11 git add file.c &&
12 git commit -m c0 &&
13 git tag c0 &&
14 cp "$TEST_DIRECTORY"/t7615/ours.c file.c &&
15 git add file.c &&
16 git commit -m c1 &&
17 git tag c1 &&
18 git reset --hard c0 &&
19 cp "$TEST_DIRECTORY"/t7615/theirs.c file.c &&
20 git add file.c &&
21 git commit -m c2 &&
22 git tag c2
23'
24
25test_expect_success 'merge c2 to c1 with recursive merge strategy fails with the current default myers diff algorithm' '
26 git reset --hard c1 &&
27 test_must_fail git merge -s recursive -Xdiff-algorithm=myers c2
28'
29
30test_expect_success 'merge c2 to c1 with recursive merge strategy succeeds with -Xdiff-algorithm=histogram' '
31 git reset --hard c1 &&
32 git merge --strategy recursive -Xdiff-algorithm=histogram c2
33'
34
35test_expect_success 'merge c2 to c1 with recursive merge strategy succeeds with diff.algorithm = histogram' '
36 git reset --hard c1 &&
37 git config diff.algorithm histogram &&
38 git merge --strategy recursive c2
39'
40
41test_expect_success 'cherry-pick c2 to c1 with recursive merge strategy fails with the current default myers diff algorithm' '
42 git reset --hard c1 &&
43 test_must_fail git cherry-pick -s recursive -Xdiff-algorithm=myers c2
44'
45
46test_expect_success 'cherry-pick c2 to c1 with recursive merge strategy succeeds with -Xdiff-algorithm=histogram' '
47 git reset --hard c1 &&
48 git cherry-pick --strategy recursive -Xdiff-algorithm=histogram c2
49'
50
51test_expect_success 'cherry-pick c2 to c1 with recursive merge strategy succeeds with diff.algorithm = histogram' '
52 git reset --hard c1 &&
53 git config diff.algorithm histogram &&
54 git cherry-pick --strategy recursive c2
55'
56
57test_done