3 test_description='combined and merge diff handle binary files and textconv'
6 test_expect_success 'setup binary merge conflict' '
7 echo oneQ1 | q_to_nul >binary &&
10 echo twoQ2 | q_to_nul >binary &&
11 git commit -a -m two &&
12 two=$(git rev-parse --short HEAD:binary) &&
13 git checkout -b branch-binary HEAD^ &&
14 echo threeQ3 | q_to_nul >binary &&
15 git commit -a -m three &&
16 three=$(git rev-parse --short HEAD:binary) &&
17 test_must_fail git merge master &&
18 echo resolvedQhooray | q_to_nul >binary &&
19 git commit -a -m resolved &&
20 res=$(git rev-parse --short HEAD:binary)
26 diff --git a/binary b/binary
27 index $three..$res 100644
28 Binary files a/binary and b/binary differ
31 diff --git a/binary b/binary
32 index $two..$res 100644
33 Binary files a/binary and b/binary differ
35 test_expect_success 'diff -m indicates binary-ness' '
36 git show --format=%s -m >actual &&
37 test_cmp expect actual
43 diff --combined binary
44 index $three,$two..$res
47 test_expect_success 'diff -c indicates binary-ness' '
48 git show --format=%s -c >actual &&
49 test_cmp expect actual
56 index $three,$two..$res
59 test_expect_success 'diff --cc indicates binary-ness' '
60 git show --format=%s --cc >actual &&
61 test_cmp expect actual
64 test_expect_success 'setup non-binary with binary attribute' '
65 git checkout master &&
66 test_commit one text &&
67 test_commit two text &&
68 two=$(git rev-parse --short HEAD:text) &&
69 git checkout -b branch-text HEAD^ &&
70 test_commit three text &&
71 three=$(git rev-parse --short HEAD:text) &&
72 test_must_fail git merge master &&
73 test_commit resolved text &&
74 res=$(git rev-parse --short HEAD:text) &&
75 echo text -diff >.gitattributes
81 diff --git a/text b/text
82 index $three..$res 100644
83 Binary files a/text and b/text differ
86 diff --git a/text b/text
87 index $two..$res 100644
88 Binary files a/text and b/text differ
90 test_expect_success 'diff -m respects binary attribute' '
91 git show --format=%s -m >actual &&
92 test_cmp expect actual
99 index $three,$two..$res
102 test_expect_success 'diff -c respects binary attribute' '
103 git show --format=%s -c >actual &&
104 test_cmp expect actual
111 index $three,$two..$res
114 test_expect_success 'diff --cc respects binary attribute' '
115 git show --format=%s --cc >actual &&
116 test_cmp expect actual
119 test_expect_success 'setup textconv attribute' '
120 echo "text diff=upcase" >.gitattributes &&
121 git config diff.upcase.textconv "tr a-z A-Z <"
127 diff --git a/text b/text
128 index $three..$res 100644
136 diff --git a/text b/text
137 index $two..$res 100644
144 test_expect_success 'diff -m respects textconv attribute' '
145 git show --format=%s -m >actual &&
146 test_cmp expect actual
153 index $three,$two..$res
156 @@@ -1,1 -1,1 +1,1 @@@
161 test_expect_success 'diff -c respects textconv attribute' '
162 git show --format=%s -c >actual &&
163 test_cmp expect actual
170 index $three,$two..$res
173 @@@ -1,1 -1,1 +1,1 @@@
178 test_expect_success 'diff --cc respects textconv attribute' '
179 git show --format=%s --cc >actual &&
180 test_cmp expect actual
185 index $three,$two..$res
188 @@@ -1,1 -1,1 +1,1 @@@
193 test_expect_success 'diff-tree plumbing does not respect textconv' '
194 git diff-tree HEAD -c -p >full &&
195 tail -n +2 full >actual &&
196 test_cmp expect actual
201 index $three,$two..0000000
204 @@@ -1,1 -1,1 +1,5 @@@
211 test_expect_success 'diff --cc respects textconv on worktree file' '
212 git reset --hard HEAD^ &&
213 test_must_fail git merge master &&
215 test_cmp expect actual