use strpbrk(3) to search for characters from a given set
[git/debian.git] / t / t4057-diff-combined-paths.sh
blob4f4b541658a1b604ee27aff76a4e2047fca8111c
1 #!/bin/sh
3 test_description='combined diff show only paths that are different to all parents'
5 . ./test-lib.sh
7 # verify that diffc.expect matches output of
8 # $(git diff -c --name-only HEAD HEAD^ HEAD^2)
9 diffc_verify () {
10 git diff -c --name-only HEAD HEAD^ HEAD^2 >diffc.actual &&
11 test_cmp diffc.expect diffc.actual
14 test_expect_success 'trivial merge - combine-diff empty' '
15 for i in $(test_seq 1 9)
17 echo $i >$i.txt &&
18 git add $i.txt
19 done &&
20 git commit -m "init" &&
21 git checkout -b side &&
22 for i in $(test_seq 2 9)
24 echo $i/2 >>$i.txt
25 done &&
26 git commit -a -m "side 2-9" &&
27 git checkout master &&
28 echo 1/2 >1.txt &&
29 git commit -a -m "master 1" &&
30 git merge side &&
31 >diffc.expect &&
32 diffc_verify
36 test_expect_success 'only one truly conflicting path' '
37 git checkout side &&
38 for i in $(test_seq 2 9)
40 echo $i/3 >>$i.txt
41 done &&
42 echo "4side" >>4.txt &&
43 git commit -a -m "side 2-9 +4" &&
44 git checkout master &&
45 for i in $(test_seq 1 9)
47 echo $i/3 >>$i.txt
48 done &&
49 echo "4master" >>4.txt &&
50 git commit -a -m "master 1-9 +4" &&
51 test_must_fail git merge side &&
52 cat <<-\EOF >4.txt &&
54 4/2
55 4/3
56 4master
57 4side
58 EOF
59 git add 4.txt &&
60 git commit -m "merge side (2)" &&
61 echo 4.txt >diffc.expect &&
62 diffc_verify
65 test_expect_success 'merge introduces new file' '
66 git checkout side &&
67 for i in $(test_seq 5 9)
69 echo $i/4 >>$i.txt
70 done &&
71 git commit -a -m "side 5-9" &&
72 git checkout master &&
73 for i in $(test_seq 1 3)
75 echo $i/4 >>$i.txt
76 done &&
77 git commit -a -m "master 1-3 +4hello" &&
78 git merge side &&
79 echo "Hello World" >4hello.txt &&
80 git add 4hello.txt &&
81 git commit --amend &&
82 echo 4hello.txt >diffc.expect &&
83 diffc_verify
86 test_expect_success 'merge removed a file' '
87 git checkout side &&
88 for i in $(test_seq 5 9)
90 echo $i/5 >>$i.txt
91 done &&
92 git commit -a -m "side 5-9" &&
93 git checkout master &&
94 for i in $(test_seq 1 3)
96 echo $i/4 >>$i.txt
97 done &&
98 git commit -a -m "master 1-3" &&
99 git merge side &&
100 git rm 4.txt &&
101 git commit --amend &&
102 echo 4.txt >diffc.expect &&
103 diffc_verify
106 test_done