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 git checkout -b branch-binary HEAD^ &&
13 echo threeQ3 | q_to_nul >binary &&
14 git commit -a -m three &&
15 test_must_fail git merge master &&
16 echo resolvedQhooray | q_to_nul >binary &&
17 git commit -a -m resolved
23 diff --git a/binary b/binary
24 index 7ea6ded..9563691 100644
25 Binary files a/binary and b/binary differ
28 diff --git a/binary b/binary
29 index 6197570..9563691 100644
30 Binary files a/binary and b/binary differ
32 test_expect_success
'diff -m indicates binary-ness' '
33 git show --format=%s -m >actual &&
34 test_cmp expect actual
40 diff --combined binary
41 index 7ea6ded,6197570..9563691
44 test_expect_success
'diff -c indicates binary-ness' '
45 git show --format=%s -c >actual &&
46 test_cmp expect actual
53 index 7ea6ded,6197570..9563691
56 test_expect_success
'diff --cc indicates binary-ness' '
57 git show --format=%s --cc >actual &&
58 test_cmp expect actual
61 test_expect_success
'setup non-binary with binary attribute' '
62 git checkout master &&
63 test_commit one text &&
64 test_commit two text &&
65 git checkout -b branch-text HEAD^ &&
66 test_commit three text &&
67 test_must_fail git merge master &&
68 test_commit resolved text &&
69 echo text -diff >.gitattributes
75 diff --git a/text b/text
76 index 2bdf67a..2ab19ae 100644
77 Binary files a/text and b/text differ
80 diff --git a/text b/text
81 index f719efd..2ab19ae 100644
82 Binary files a/text and b/text differ
84 test_expect_success
'diff -m respects binary attribute' '
85 git show --format=%s -m >actual &&
86 test_cmp expect actual
93 index 2bdf67a,f719efd..2ab19ae
96 test_expect_success
'diff -c respects binary attribute' '
97 git show --format=%s -c >actual &&
98 test_cmp expect actual
105 index 2bdf67a,f719efd..2ab19ae
108 test_expect_success
'diff --cc respects binary attribute' '
109 git show --format=%s --cc >actual &&
110 test_cmp expect actual
113 test_expect_success
'setup textconv attribute' '
114 echo "text diff=upcase" >.gitattributes &&
115 git config diff.upcase.textconv "tr a-z A-Z <"
121 diff --git a/text b/text
122 index 2bdf67a..2ab19ae 100644
130 diff --git a/text b/text
131 index f719efd..2ab19ae 100644
138 test_expect_success
'diff -m respects textconv attribute' '
139 git show --format=%s -m >actual &&
140 test_cmp expect actual
147 index 2bdf67a,f719efd..2ab19ae
150 @@@ -1,1 -1,1 +1,1 @@@
155 test_expect_success
'diff -c respects textconv attribute' '
156 git show --format=%s -c >actual &&
157 test_cmp expect actual
164 index 2bdf67a,f719efd..2ab19ae
167 @@@ -1,1 -1,1 +1,1 @@@
172 test_expect_success
'diff --cc respects textconv attribute' '
173 git show --format=%s --cc >actual &&
174 test_cmp expect actual
179 index 2bdf67a,f719efd..2ab19ae
182 @@@ -1,1 -1,1 +1,1 @@@
187 test_expect_success
'diff-tree plumbing does not respect textconv' '
188 git diff-tree HEAD -c -p >full &&
189 tail -n +2 full >actual &&
190 test_cmp expect actual
195 index 2bdf67a,f719efd..0000000
198 @@@ -1,1 -1,1 +1,5 @@@
205 test_expect_success
'diff --cc respects textconv on worktree file' '
206 git reset --hard HEAD^ &&
207 test_must_fail git merge master &&
209 test_cmp expect actual