tests: do not use implicit "git diff --no-index"
As a general principle, we should not use "git diff" to validate the results of what git command that is being tested has done. We would not know if we are testing the command in question, or locating a bug in the cute hack of "git diff --no-index". Rather use test_cmp for that purpose. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
May 23, 2008 at 22:28 UTC
3af828634fa5bdbca1b2061a81df8b3fa73b0d34
50 files changed
+387
-387
t/diff-lib.sh
+3
-3
@@ -11,7 +11,7 @@ compare_diff_raw () {
11
12
sed -e "$sanitize_diff_raw" <"$1" >.tmp-1
13
sed -e "$sanitize_diff_raw" <"$2" >.tmp-2
14
- git diff .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
14
+ test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
15
}
16
17
sanitize_diff_raw_z='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]*$/ X X \1#/'
@@ -23,7 +23,7 @@ compare_diff_raw_z () {
23
24
perl -pe 'y/\000/\012/' <"$1" | sed -e "$sanitize_diff_raw_z" >.tmp-1
25
perl -pe 'y/\000/\012/' <"$2" | sed -e "$sanitize_diff_raw_z" >.tmp-2
26
- git diff .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
26
+ test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
27
}
28
29
compare_diff_patch () {
@@ -37,5 +37,5 @@ compare_diff_patch () {
37
/^[dis]*imilarity index [0-9]*%$/d
38
/^index [0-9a-f]*\.\.[0-9a-f]/d
39
' <"$2" >.tmp-2
40
- git diff .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
40
+ test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
41
}
t/t0030-stripspace.sh
+78
-78
@@ -16,96 +16,96 @@ test_expect_success \
16
'long lines without spaces should be unchanged' '
17
echo "$ttt" >expect &&
18
git stripspace <expect >actual &&
19
- git diff expect actual &&
19
+ test_cmp expect actual &&
20
21
echo "$ttt$ttt" >expect &&
22
git stripspace <expect >actual &&
23
- git diff expect actual &&
23
+ test_cmp expect actual &&
24
25
echo "$ttt$ttt$ttt" >expect &&
26
git stripspace <expect >actual &&
27
- git diff expect actual &&
27
+ test_cmp expect actual &&
28
29
echo "$ttt$ttt$ttt$ttt" >expect &&
30
git stripspace <expect >actual &&
31
- git diff expect actual
31
+ test_cmp expect actual
32
'
33
34
test_expect_success \
35
'lines with spaces at the beginning should be unchanged' '
36
echo "$sss$ttt" >expect &&
37
git stripspace <expect >actual &&
38
- git diff expect actual &&
38
+ test_cmp expect actual &&
39
40
echo "$sss$sss$ttt" >expect &&
41
git stripspace <expect >actual &&
42
- git diff expect actual &&
42
+ test_cmp expect actual &&
43
44
echo "$sss$sss$sss$ttt" >expect &&
45
git stripspace <expect >actual &&
46
- git diff expect actual
46
+ test_cmp expect actual
47
'
48
49
test_expect_success \
50
'lines with intermediate spaces should be unchanged' '
51
echo "$ttt$sss$ttt" >expect &&
52
git stripspace <expect >actual &&
53
- git diff expect actual &&
53
+ test_cmp expect actual &&
54
55
echo "$ttt$sss$sss$ttt" >expect &&
56
git stripspace <expect >actual &&
57
- git diff expect actual
57
+ test_cmp expect actual
58
'
59
60
test_expect_success \
61
'consecutive blank lines should be unified' '
62
printf "$ttt\n\n$ttt\n" > expect &&
63
printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
64
- git diff expect actual &&
64
+ test_cmp expect actual &&
65
66
printf "$ttt$ttt\n\n$ttt\n" > expect &&
67
printf "$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
68
- git diff expect actual &&
68
+ test_cmp expect actual &&
69
70
printf "$ttt$ttt$ttt\n\n$ttt\n" > expect &&
71
printf "$ttt$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
72
- git diff expect actual &&
72
+ test_cmp expect actual &&
73
74
printf "$ttt\n\n$ttt\n" > expect &&
75
printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
76
- git diff expect actual &&
76
+ test_cmp expect actual &&
77
78
printf "$ttt\n\n$ttt$ttt\n" > expect &&
79
printf "$ttt\n\n\n\n\n$ttt$ttt\n" | git stripspace >actual &&
80
- git diff expect actual &&
80
+ test_cmp expect actual &&
81
82
printf "$ttt\n\n$ttt$ttt$ttt\n" > expect &&
83
printf "$ttt\n\n\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual &&
84
- git diff expect actual &&
84
+ test_cmp expect actual &&
85
86
printf "$ttt\n\n$ttt\n" > expect &&
87
printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
88
- git diff expect actual &&
88
+ test_cmp expect actual &&
89
90
printf "$ttt$ttt\n\n$ttt\n" > expect &&
91
printf "$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
92
- git diff expect actual &&
92
+ test_cmp expect actual &&
93
94
printf "$ttt$ttt$ttt\n\n$ttt\n" > expect &&
95
printf "$ttt$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
96
- git diff expect actual &&
96
+ test_cmp expect actual &&
97
98
printf "$ttt\n\n$ttt\n" > expect &&
99
printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
100
- git diff expect actual &&
100
+ test_cmp expect actual &&
101
102
printf "$ttt\n\n$ttt$ttt\n" > expect &&
103
printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt\n" | git stripspace >actual &&
104
- git diff expect actual &&
104
+ test_cmp expect actual &&
105
106
printf "$ttt\n\n$ttt$ttt$ttt\n" > expect &&
107
printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt$ttt\n" | git stripspace >actual &&
108
- git diff expect actual
108
+ test_cmp expect actual
109
'
110
111
test_expect_success \
@@ -113,114 +113,114 @@ test_expect_success \
113
> expect &&
114
115
printf "\n" | git stripspace >actual &&
116
- git diff expect actual &&
116
+ test_cmp expect actual &&
117
118
printf "\n\n\n" | git stripspace >actual &&
119
- git diff expect actual &&
119
+ test_cmp expect actual &&
120
121
printf "$sss\n$sss\n$sss\n" | git stripspace >actual &&
122
- git diff expect actual &&
122
+ test_cmp expect actual &&
123
124
printf "$sss$sss\n$sss\n\n" | git stripspace >actual &&
125
- git diff expect actual &&
125
+ test_cmp expect actual &&
126
127
printf "\n$sss\n$sss$sss\n" | git stripspace >actual &&
128
- git diff expect actual &&
128
+ test_cmp expect actual &&
129
130
printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual &&
131
- git diff expect actual &&
131
+ test_cmp expect actual &&
132
133
printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual &&
134
- git diff expect actual &&
134
+ test_cmp expect actual &&
135
136
printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual &&
137
- git diff expect actual
137
+ test_cmp expect actual
138
'
139
140
test_expect_success \
141
'consecutive blank lines at the beginning should be removed' '
142
printf "$ttt\n" > expect &&
143
printf "\n$ttt\n" | git stripspace >actual &&
144
- git diff expect actual &&
144
+ test_cmp expect actual &&
145
146
printf "$ttt\n" > expect &&
147
printf "\n\n\n$ttt\n" | git stripspace >actual &&
148
- git diff expect actual &&
148
+ test_cmp expect actual &&
149
150
printf "$ttt$ttt\n" > expect &&
151
printf "\n\n\n$ttt$ttt\n" | git stripspace >actual &&
152
- git diff expect actual &&
152
+ test_cmp expect actual &&
153
154
printf "$ttt$ttt$ttt\n" > expect &&
155
printf "\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual &&
156
- git diff expect actual &&
156
+ test_cmp expect actual &&
157
158
printf "$ttt$ttt$ttt$ttt\n" > expect &&
159
printf "\n\n\n$ttt$ttt$ttt$ttt\n" | git stripspace >actual &&
160
- git diff expect actual &&
160
+ test_cmp expect actual &&
161
162
printf "$ttt\n" > expect &&
163
164
printf "$sss\n$sss\n$sss\n$ttt\n" | git stripspace >actual &&
165
- git diff expect actual &&
165
+ test_cmp expect actual &&
166
167
printf "\n$sss\n$sss$sss\n$ttt\n" | git stripspace >actual &&
168
- git diff expect actual &&
168
+ test_cmp expect actual &&
169
170
printf "$sss$sss\n$sss\n\n$ttt\n" | git stripspace >actual &&
171
- git diff expect actual &&
171
+ test_cmp expect actual &&
172
173
printf "$sss$sss$sss\n\n\n$ttt\n" | git stripspace >actual &&
174
- git diff expect actual &&
174
+ test_cmp expect actual &&
175
176
printf "\n$sss$sss$sss\n\n$ttt\n" | git stripspace >actual &&
177
- git diff expect actual &&
177
+ test_cmp expect actual &&
178
179
printf "\n\n$sss$sss$sss\n$ttt\n" | git stripspace >actual &&
180
- git diff expect actual
180
+ test_cmp expect actual
181
'
182
183
test_expect_success \
184
'consecutive blank lines at the end should be removed' '
185
printf "$ttt\n" > expect &&
186
printf "$ttt\n\n" | git stripspace >actual &&
187
- git diff expect actual &&
187
+ test_cmp expect actual &&
188
189
printf "$ttt\n" > expect &&
190
printf "$ttt\n\n\n\n" | git stripspace >actual &&
191
- git diff expect actual &&
191
+ test_cmp expect actual &&
192
193
printf "$ttt$ttt\n" > expect &&
194
printf "$ttt$ttt\n\n\n\n" | git stripspace >actual &&
195
- git diff expect actual &&
195
+ test_cmp expect actual &&
196
197
printf "$ttt$ttt$ttt\n" > expect &&
198
printf "$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual &&
199
- git diff expect actual &&
199
+ test_cmp expect actual &&
200
201
printf "$ttt$ttt$ttt$ttt\n" > expect &&
202
printf "$ttt$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual &&
203
- git diff expect actual &&
203
+ test_cmp expect actual &&
204
205
printf "$ttt\n" > expect &&
206
207
printf "$ttt\n$sss\n$sss\n$sss\n" | git stripspace >actual &&
208
- git diff expect actual &&
208
+ test_cmp expect actual &&
209
210
printf "$ttt\n\n$sss\n$sss$sss\n" | git stripspace >actual &&
211
- git diff expect actual &&
211
+ test_cmp expect actual &&
212
213
printf "$ttt\n$sss$sss\n$sss\n\n" | git stripspace >actual &&
214
- git diff expect actual &&
214
+ test_cmp expect actual &&
215
216
printf "$ttt\n$sss$sss$sss\n\n\n" | git stripspace >actual &&
217
- git diff expect actual &&
217
+ test_cmp expect actual &&
218
219
printf "$ttt\n\n$sss$sss$sss\n\n" | git stripspace >actual &&
220
- git diff expect actual &&
220
+ test_cmp expect actual &&
221
222
printf "$ttt\n\n\n$sss$sss$sss\n" | git stripspace >actual &&
223
- git diff expect actual
223
+ test_cmp expect actual
224
'
225
226
test_expect_success \
@@ -257,27 +257,27 @@ test_expect_success \
257
'text plus spaces without newline should show the correct lines' '
258
printf "$ttt\n" >expect &&
259
printf "$ttt$sss" | git stripspace >actual &&
260
- git diff expect actual &&
260
+ test_cmp expect actual &&
261
262
printf "$ttt\n" >expect &&
263
printf "$ttt$sss$sss" | git stripspace >actual &&
264
- git diff expect actual &&
264
+ test_cmp expect actual &&
265
266
printf "$ttt\n" >expect &&
267
printf "$ttt$sss$sss$sss" | git stripspace >actual &&
268
- git diff expect actual &&
268
+ test_cmp expect actual &&
269
270
printf "$ttt$ttt\n" >expect &&
271
printf "$ttt$ttt$sss" | git stripspace >actual &&
272
- git diff expect actual &&
272
+ test_cmp expect actual &&
273
274
printf "$ttt$ttt\n" >expect &&
275
printf "$ttt$ttt$sss$sss" | git stripspace >actual &&
276
- git diff expect actual &&
276
+ test_cmp expect actual &&
277
278
printf "$ttt$ttt$ttt\n" >expect &&
279
printf "$ttt$ttt$ttt$sss" | git stripspace >actual &&
280
- git diff expect actual
280
+ test_cmp expect actual
281
'
282
283
test_expect_success \
@@ -294,27 +294,27 @@ test_expect_success \
294
'text plus spaces at end should be cleaned and newline must remain' '
295
echo "$ttt" >expect &&
296
echo "$ttt$sss" | git stripspace >actual &&
297
- git diff expect actual &&
297
+ test_cmp expect actual &&
298
299
echo "$ttt" >expect &&
300
echo "$ttt$sss$sss" | git stripspace >actual &&
301
- git diff expect actual &&
301
+ test_cmp expect actual &&
302
303
echo "$ttt" >expect &&
304
echo "$ttt$sss$sss$sss" | git stripspace >actual &&
305
- git diff expect actual &&
305
+ test_cmp expect actual &&
306
307
echo "$ttt$ttt" >expect &&
308
echo "$ttt$ttt$sss" | git stripspace >actual &&
309
- git diff expect actual &&
309
+ test_cmp expect actual &&
310
311
echo "$ttt$ttt" >expect &&
312
echo "$ttt$ttt$sss$sss" | git stripspace >actual &&
313
- git diff expect actual &&
313
+ test_cmp expect actual &&
314
315
echo "$ttt$ttt$ttt" >expect &&
316
echo "$ttt$ttt$ttt$sss" | git stripspace >actual &&
317
- git diff expect actual
317
+ test_cmp expect actual
318
'
319
320
# spaces only:
@@ -324,19 +324,19 @@ test_expect_success \
324
printf "" >expect &&
325
326
echo | git stripspace >actual &&
327
- git diff expect actual &&
327
+ test_cmp expect actual &&
328
329
echo "$sss" | git stripspace >actual &&
330
- git diff expect actual &&
330
+ test_cmp expect actual &&
331
332
echo "$sss$sss" | git stripspace >actual &&
333
- git diff expect actual &&
333
+ test_cmp expect actual &&
334
335
echo "$sss$sss$sss" | git stripspace >actual &&
336
- git diff expect actual &&
336
+ test_cmp expect actual &&
337
338
echo "$sss$sss$sss$sss" | git stripspace >actual &&
339
- git diff expect actual
339
+ test_cmp expect actual
340
'
341
342
test_expect_success \
@@ -353,43 +353,43 @@ test_expect_success \
353
printf "" >expect &&
354
355
printf "" | git stripspace >actual &&
356
- git diff expect actual &&
356
+ test_cmp expect actual &&
357
358
printf "$sss$sss" | git stripspace >actual &&
359
- git diff expect actual &&
359
+ test_cmp expect actual &&
360
361
printf "$sss$sss$sss" | git stripspace >actual &&
362
- git diff expect actual &&
362
+ test_cmp expect actual &&
363
364
printf "$sss$sss$sss$sss" | git stripspace >actual &&
365
- git diff expect actual
365
+ test_cmp expect actual
366
'
367
368
test_expect_success \
369
'consecutive text lines should be unchanged' '
370
printf "$ttt$ttt\n$ttt\n" >expect &&
371
printf "$ttt$ttt\n$ttt\n" | git stripspace >actual &&
372
- git diff expect actual &&
372
+ test_cmp expect actual &&
373
374
printf "$ttt\n$ttt$ttt\n$ttt\n" >expect &&
375
printf "$ttt\n$ttt$ttt\n$ttt\n" | git stripspace >actual &&
376
- git diff expect actual &&
376
+ test_cmp expect actual &&
377
378
printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" >expect &&
379
printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" | git stripspace >actual &&
380
- git diff expect actual &&
380
+ test_cmp expect actual &&
381
382
printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" >expect &&
383
printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" | git stripspace >actual &&
384
- git diff expect actual &&
384
+ test_cmp expect actual &&
385
386
printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" >expect &&
387
printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" | git stripspace >actual &&
388
- git diff expect actual &&
388
+ test_cmp expect actual &&
389
390
printf "$ttt\n$ttt$ttt\n\n$ttt\n" >expect &&
391
printf "$ttt\n$ttt$ttt\n\n$ttt\n" | git stripspace >actual &&
392
- git diff expect actual
392
+ test_cmp expect actual
393
'
394
395
test_expect_success 'strip comments, too' '
t/t0040-parse-options.sh
+9
-9
@@ -29,7 +29,7 @@ EOF
29
test_expect_success 'test help' '
30
! test-parse-options -h > output 2> output.err &&
31
test ! -s output &&
32
- git diff expect.err output.err
32
+ test_cmp expect.err output.err
33
'
34
35
cat > expect << EOF
@@ -40,7 +40,7 @@ EOF
40
41
test_expect_success 'short options' '
42
test-parse-options -s123 -b -i 1729 -b > output 2> output.err &&
43
- git diff expect output &&
43
+ test_cmp expect output &&
44
test ! -s output.err
45
'
46
cat > expect << EOF
@@ -53,7 +53,7 @@ test_expect_success 'long options' '
53
test-parse-options --boolean --integer 1729 --boolean --string2=321 \
54
> output 2> output.err &&
55
test ! -s output.err &&
56
- git diff expect output
56
+ test_cmp expect output
57
'
58
59
cat > expect << EOF
@@ -69,7 +69,7 @@ test_expect_success 'intermingled arguments' '
69
test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
70
> output 2> output.err &&
71
test ! -s output.err &&
72
- git diff expect output
72
+ test_cmp expect output
73
'
74
75
cat > expect << EOF
@@ -81,13 +81,13 @@ EOF
81
test_expect_success 'unambiguously abbreviated option' '
82
test-parse-options --int 2 --boolean --no-bo > output 2> output.err &&
83
test ! -s output.err &&
84
- git diff expect output
84
+ test_cmp expect output
85
'
86
87
test_expect_success 'unambiguously abbreviated option with "="' '
88
test-parse-options --int=2 > output 2> output.err &&
89
test ! -s output.err &&
90
- git diff expect output
90
+ test_cmp expect output
91
'
92
93
test_expect_success 'ambiguously abbreviated option' '
@@ -104,7 +104,7 @@ EOF
104
test_expect_success 'non ambiguous option (after two options it abbreviates)' '
105
test-parse-options --st 123 > output 2> output.err &&
106
test ! -s output.err &&
107
- git diff expect output
107
+ test_cmp expect output
108
'
109
110
cat > expect.err << EOF
@@ -114,7 +114,7 @@ EOF
114
test_expect_success 'detect possible typos' '
115
! test-parse-options -boolean > output 2> output.err &&
116
test ! -s output &&
117
- git diff expect.err output.err
117
+ test_cmp expect.err output.err
118
'
119
120
cat > expect <<EOF
@@ -127,7 +127,7 @@ EOF
127
test_expect_success 'keep some options as arguments' '
128
test-parse-options --quux > output 2> output.err &&
129
test ! -s output.err &&
130
- git diff expect output
130
+ test_cmp expect output
131
'
132
133
test_done
t/t1000-read-tree-m-3way.sh
+1
-1
@@ -131,7 +131,7 @@ _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
131
132
check_result () {
133
git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current &&
134
- git diff expected current
134
+ test_cmp expected current
135
}
136
137
# This is done on an empty work directory, which is the normal
t/t1001-read-tree-m-2way.sh
+13
-13
@@ -33,7 +33,7 @@ compare_change () {
33
-e '/^--- /d; /^+++ /d; /^@@ /d;' \
34
-e 's/^\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /p' \
35
"$1"
36
- git diff expected current
36
+ test_cmp expected current
37
}
38
39
check_cache_at () {
@@ -86,7 +86,7 @@ test_expect_success \
86
'rm -f .git/index &&
87
read_tree_twoway $treeH $treeM &&
88
git ls-files --stage >1-3.out &&
89
- git diff M.out 1-3.out &&
89
+ test_cmp M.out 1-3.out &&
90
check_cache_at bozbar dirty &&
91
check_cache_at frotz dirty &&
92
check_cache_at nitfol dirty'
@@ -101,7 +101,7 @@ test_expect_success \
101
git update-index --add yomin &&
102
read_tree_twoway $treeH $treeM &&
103
git ls-files --stage >4.out || return 1
104
- git diff M.out 4.out >4diff.out
104
+ git diff --no-index M.out 4.out >4diff.out
105
compare_change 4diff.out expected &&
106
check_cache_at yomin clean'
107
@@ -115,7 +115,7 @@ test_expect_success \
115
echo yomin yomin >yomin &&
116
read_tree_twoway $treeH $treeM &&
117
git ls-files --stage >5.out || return 1
118
- git diff M.out 5.out >5diff.out
118
+ git diff --no-index M.out 5.out >5diff.out
119
compare_change 5diff.out expected &&
120
check_cache_at yomin dirty'
121
@@ -127,7 +127,7 @@ test_expect_success \
127
git update-index --add frotz &&
128
read_tree_twoway $treeH $treeM &&
129
git ls-files --stage >6.out &&
130
- git diff M.out 6.out &&
130
+ test_cmp M.out 6.out &&
131
check_cache_at frotz clean'
132
133
test_expect_success \
@@ -140,7 +140,7 @@ test_expect_success \
140
echo frotz frotz >frotz &&
141
read_tree_twoway $treeH $treeM &&
142
git ls-files --stage >7.out &&
143
- git diff M.out 7.out &&
143
+ test_cmp M.out 7.out &&
144
check_cache_at frotz dirty'
145
146
test_expect_success \
@@ -171,7 +171,7 @@ test_expect_success \
171
git update-index --add rezrov &&
172
read_tree_twoway $treeH $treeM &&
173
git ls-files --stage >10.out &&
174
- git diff M.out 10.out'
174
+ test_cmp M.out 10.out'
175
176
test_expect_success \
177
'11 - dirty path removed.' \
@@ -216,7 +216,7 @@ test_expect_success \
216
git update-index --add nitfol &&
217
read_tree_twoway $treeH $treeM &&
218
git ls-files --stage >14.out || return 1
219
- git diff M.out 14.out >14diff.out
219
+ git diff --no-index M.out 14.out >14diff.out
220
compare_change 14diff.out expected &&
221
check_cache_at nitfol clean'
222
@@ -230,7 +230,7 @@ test_expect_success \
230
echo nitfol nitfol nitfol >nitfol &&
231
read_tree_twoway $treeH $treeM &&
232
git ls-files --stage >15.out || return 1
233
- git diff M.out 15.out >15diff.out
233
+ git diff --no-index M.out 15.out >15diff.out
234
compare_change 15diff.out expected &&
235
check_cache_at nitfol dirty'
236
@@ -262,7 +262,7 @@ test_expect_success \
262
git update-index --add bozbar &&
263
read_tree_twoway $treeH $treeM &&
264
git ls-files --stage >18.out &&
265
- git diff M.out 18.out &&
265
+ test_cmp M.out 18.out &&
266
check_cache_at bozbar clean'
267
268
test_expect_success \
@@ -275,7 +275,7 @@ test_expect_success \
275
echo gnusto gnusto >bozbar &&
276
read_tree_twoway $treeH $treeM &&
277
git ls-files --stage >19.out &&
278
- git diff M.out 19.out &&
278
+ test_cmp M.out 19.out &&
279
check_cache_at bozbar dirty'
280
281
test_expect_success \
@@ -287,7 +287,7 @@ test_expect_success \
287
git update-index --add bozbar &&
288
read_tree_twoway $treeH $treeM &&
289
git ls-files --stage >20.out &&
290
- git diff M.out 20.out &&
290
+ test_cmp M.out 20.out &&
291
check_cache_at bozbar dirty'
292
293
test_expect_success \
@@ -337,7 +337,7 @@ test_expect_success \
337
git update-index --add DF &&
338
read_tree_twoway $treeDF $treeDFDF &&
339
git ls-files --stage >DFDFcheck.out &&
340
- git diff DFDF.out DFDFcheck.out &&
340
+ test_cmp DFDF.out DFDFcheck.out &&
341
check_cache_at DF/DF dirty &&
342
:'
343
t/t1002-read-tree-m-u-2way.sh
+1
-1
@@ -16,7 +16,7 @@ compare_change () {
16
sed >current \
17
-e '/^--- /d; /^+++ /d; /^@@ /d;' \
18
-e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /' "$1"
19
- git diff expected current
19
+ test_cmp expected current
20
}
21
22
check_cache_at () {
t/t1300-repo-config.sh
+4
-4
@@ -427,13 +427,13 @@ cat > expect << EOF
427
weird
428
EOF
429
430
-test_expect_success "rename succeeded" "git diff expect .git/config"
430
+test_expect_success "rename succeeded" "test_cmp expect .git/config"
431
432
test_expect_success "rename non-existing section" '
433
! git config --rename-section branch."world domination" branch.drei
434
'
435
436
-test_expect_success "rename succeeded" "git diff expect .git/config"
436
+test_expect_success "rename succeeded" "test_cmp expect .git/config"
437
438
test_expect_success "rename another section" \
439
'git config --rename-section branch."1 234 blabl/a" branch.drei'
@@ -449,7 +449,7 @@ cat > expect << EOF
449
weird
450
EOF
451
452
-test_expect_success "rename succeeded" "git diff expect .git/config"
452
+test_expect_success "rename succeeded" "test_cmp expect .git/config"
453
454
cat >> .git/config << EOF
455
[branch "zwei"] a = 1 [branch "vier"]
@@ -465,7 +465,7 @@ weird
465
EOF
466
467
test_expect_success "section was removed properly" \
468
- "git diff -u expect .git/config"
468
+ "test_cmp expect .git/config"
469
470
rm .git/config
471
t/t1303-wacky-config.sh
+1
-1
@@ -11,7 +11,7 @@ setup() {
11
check() {
12
echo "$2" >expected
13
git config --get "$1" >actual
14
- git diff actual expected
14
+ test_cmp actual expected
15
}
16
17
test_expect_success 'modify same key' '
t/t1502-rev-parse-parseopt.sh
+1
-1
@@ -37,7 +37,7 @@ C? option C with an optional argument
37
Extras
38
extra1 line above used to cause a segfault but no longer does
39
EOF
40
- git diff expect.err output.err
40
+ test_cmp expect.err output.err
41
'
42
43
test_done
t/t3001-ls-files-others-exclude.sh
+2
-2
@@ -65,7 +65,7 @@ test_expect_success \
65
--exclude-per-directory=.gitignore \
66
--exclude-from=.git/ignore \
67
>output &&
68
- git diff expect output'
68
+ test_cmp expect output'
69
70
# Test \r\n (MSDOS-like systems)
71
printf '*.1\r\n/*.3\r\n!*.6\r\n' >.gitignore
@@ -77,7 +77,7 @@ test_expect_success \
77
--exclude-per-directory=.gitignore \
78
--exclude-from=.git/ignore \
79
>output &&
80
- git diff expect output'
80
+ test_cmp expect output'
81
82
cat > excludes-file << EOF
83
*.[1-8]
t/t3002-ls-files-dashpath.sh
+5
-5
@@ -23,7 +23,7 @@ test_expect_success \
23
test_expect_success \
24
'git ls-files without path restriction.' \
25
'git ls-files --others >output &&
26
- git diff output - <<EOF
26
+ test_cmp output - <<EOF
27
--
28
-foo
29
output
@@ -34,7 +34,7 @@ EOF
34
test_expect_success \
35
'git ls-files with path restriction.' \
36
'git ls-files --others path0 >output &&
37
- git diff output - <<EOF
37
+ test_cmp output - <<EOF
38
path0
39
EOF
40
'
@@ -42,7 +42,7 @@ EOF
42
test_expect_success \
43
'git ls-files with path restriction with --.' \
44
'git ls-files --others -- path0 >output &&
45
- git diff output - <<EOF
45
+ test_cmp output - <<EOF
46
path0
47
EOF
48
'
@@ -50,7 +50,7 @@ EOF
50
test_expect_success \
51
'git ls-files with path restriction with -- --.' \
52
'git ls-files --others -- -- >output &&
53
- git diff output - <<EOF
53
+ test_cmp output - <<EOF
54
--
55
EOF
56
'
@@ -58,7 +58,7 @@ EOF
58
test_expect_success \
59
'git ls-files with no path restriction.' \
60
'git ls-files --others -- >output &&
61
- git diff output - <<EOF
61
+ test_cmp output - <<EOF
62
--
63
-foo
64
output
t/t3030-merge-recursive.sh
+21
-21
@@ -43,7 +43,7 @@ test_expect_success 'setup 1' '
43
echo "100644 $o0 0 c"
44
echo "100644 $o1 0 d/e"
45
) >expected &&
46
- git diff -u expected actual
46
+ test_cmp expected actual
47
'
48
49
test_expect_success 'setup 2' '
@@ -61,7 +61,7 @@ test_expect_success 'setup 2' '
61
echo "100644 $o0 0 c"
62
echo "100644 $o0 0 d/e"
63
) >expected &&
64
- git diff -u expected actual &&
64
+ test_cmp expected actual &&
65
66
echo goodbye >>a &&
67
o2=$(git hash-object a) &&
@@ -82,7 +82,7 @@ test_expect_success 'setup 2' '
82
echo "100644 $o0 0 c"
83
echo "100644 $o0 0 d/e"
84
) >expected &&
85
- git diff -u expected actual
85
+ test_cmp expected actual
86
'
87
88
test_expect_success 'setup 3' '
@@ -100,7 +100,7 @@ test_expect_success 'setup 3' '
100
echo "100644 $o0 0 c"
101
echo "100644 $o0 0 d/e"
102
) >expected &&
103
- git diff -u expected actual &&
103
+ test_cmp expected actual &&
104
105
rm -f b && mkdir b && echo df-1 >b/c && git add b/c &&
106
o3=$(git hash-object b/c) &&
@@ -119,7 +119,7 @@ test_expect_success 'setup 3' '
119
echo "100644 $o0 0 c"
120
echo "100644 $o0 0 d/e"
121
) >expected &&
122
- git diff -u expected actual
122
+ test_cmp expected actual
123
'
124
125
test_expect_success 'setup 4' '
@@ -137,7 +137,7 @@ test_expect_success 'setup 4' '
137
echo "100644 $o0 0 c"
138
echo "100644 $o0 0 d/e"
139
) >expected &&
140
- git diff -u expected actual &&
140
+ test_cmp expected actual &&
141
142
rm -f a && mkdir a && echo df-2 >a/c && git add a/c &&
143
o4=$(git hash-object a/c) &&
@@ -156,7 +156,7 @@ test_expect_success 'setup 4' '
156
echo "100644 $o0 0 c"
157
echo "100644 $o0 0 d/e"
158
) >expected &&
159
- git diff -u expected actual
159
+ test_cmp expected actual
160
'
161
162
test_expect_success 'setup 5' '
@@ -174,7 +174,7 @@ test_expect_success 'setup 5' '
174
echo "100644 $o0 0 c"
175
echo "100644 $o0 0 d/e"
176
) >expected &&
177
- git diff -u expected actual &&
177
+ test_cmp expected actual &&
178
179
rm -f b &&
180
echo remove-conflict >a &&
@@ -195,7 +195,7 @@ test_expect_success 'setup 5' '
195
echo "100644 $o0 0 c"
196
echo "100644 $o0 0 d/e"
197
) >expected &&
198
- git diff -u expected actual
198
+ test_cmp expected actual
199
200
'
201
@@ -214,7 +214,7 @@ test_expect_success 'setup 6' '
214
echo "100644 $o0 0 c"
215
echo "100644 $o0 0 d/e"
216
) >expected &&
217
- git diff -u expected actual &&
217
+ test_cmp expected actual &&
218
219
rm -fr d && echo df-3 >d && git add d &&
220
o6=$(git hash-object d) &&
@@ -233,7 +233,7 @@ test_expect_success 'setup 6' '
233
echo "100644 $o0 0 c"
234
echo "100644 $o6 0 d"
235
) >expected &&
236
- git diff -u expected actual
236
+ test_cmp expected actual
237
'
238
239
test_expect_success 'merge-recursive simple' '
@@ -265,7 +265,7 @@ test_expect_success 'merge-recursive result' '
265
echo "100644 $o0 0 c"
266
echo "100644 $o1 0 d/e"
267
) >expected &&
268
- git diff -u expected actual
268
+ test_cmp expected actual
269
270
'
271
@@ -297,7 +297,7 @@ test_expect_success 'merge-recursive remove conflict' '
297
echo "100644 $o0 0 c"
298
echo "100644 $o1 0 d/e"
299
) >expected &&
300
- git diff -u expected actual
300
+ test_cmp expected actual
301
302
'
303
@@ -318,7 +318,7 @@ test_expect_success 'merge-recursive result' '
318
echo "100644 $o0 0 c"
319
echo "100644 $o1 0 d/e"
320
) >expected &&
321
- git diff -u expected actual
321
+ test_cmp expected actual
322
323
'
324
@@ -352,7 +352,7 @@ test_expect_success 'merge-recursive d/f conflict result' '
352
echo "100644 $o0 0 c"
353
echo "100644 $o1 0 d/e"
354
) >expected &&
355
- git diff -u expected actual
355
+ test_cmp expected actual
356
357
'
358
@@ -386,7 +386,7 @@ test_expect_success 'merge-recursive d/f conflict result the other way' '
386
echo "100644 $o0 0 c"
387
echo "100644 $o1 0 d/e"
388
) >expected &&
389
- git diff -u expected actual
389
+ test_cmp expected actual
390
391
'
392
@@ -420,7 +420,7 @@ test_expect_success 'merge-recursive d/f conflict result' '
420
echo "100644 $o0 1 d/e"
421
echo "100644 $o1 2 d/e"
422
) >expected &&
423
- git diff -u expected actual
423
+ test_cmp expected actual
424
425
'
426
@@ -454,7 +454,7 @@ test_expect_success 'merge-recursive d/f conflict result' '
454
echo "100644 $o0 1 d/e"
455
echo "100644 $o1 3 d/e"
456
) >expected &&
457
- git diff -u expected actual
457
+ test_cmp expected actual
458
459
'
460
@@ -480,7 +480,7 @@ test_expect_success 'reset and bind merge' '
480
echo "100644 $o0 0 c"
481
echo "100644 $o1 0 d/e"
482
) >expected &&
483
- git diff -u expected actual &&
483
+ test_cmp expected actual &&
484
485
git read-tree --prefix=a1/ master &&
486
git ls-files -s >actual &&
@@ -498,7 +498,7 @@ test_expect_success 'reset and bind merge' '
498
echo "100644 $o0 0 c"
499
echo "100644 $o1 0 d/e"
500
) >expected &&
501
- git diff -u expected actual
501
+ test_cmp expected actual
502
503
git read-tree --prefix=z/ master &&
504
git ls-files -s >actual &&
@@ -520,7 +520,7 @@ test_expect_success 'reset and bind merge' '
520
echo "100644 $o0 0 z/c"
521
echo "100644 $o1 0 z/d/e"
522
) >expected &&
523
- git diff -u expected actual
523
+ test_cmp expected actual
524
525
'
526
t/t3040-subprojects-basic.sh
+2
-2
@@ -24,7 +24,7 @@ test_expect_success 'create subprojects' \
24
git add sub2 &&
25
git commit -q -m "subprojects added" &&
26
git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current &&
27
- git diff expected current'
27
+ test_cmp expected current'
28
29
git branch save HEAD
30
@@ -62,7 +62,7 @@ test_expect_success 'check if clone works' \
62
'git ls-files -s >expected &&
63
git clone -l -s . cloned &&
64
( cd cloned && git ls-files -s ) >current &&
65
- git diff expected current'
65
+ test_cmp expected current'
66
67
test_expect_success 'removing and adding subproject' \
68
'git update-index --force-remove -- sub2 &&
t/t3100-ls-tree-restrict.sh
+1
-1
@@ -35,7 +35,7 @@ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
35
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
36
test_output () {
37
sed -e "s/ $_x40 / X /" <current >check
38
- git diff expected check
38
+ test_cmp expected check
39
}
40
41
test_expect_success \
t/t3101-ls-tree-dirname.sh
+1
-1
@@ -43,7 +43,7 @@ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
43
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
44
test_output () {
45
sed -e "s/ $_x40 / X /" <current >check
46
- git diff expected check
46
+ test_cmp expected check
47
}
48
49
test_expect_success \
t/t3300-funny-names.sh
+15
-15
@@ -35,7 +35,7 @@ no-funny' >expected
35
test_expect_success 'git ls-files no-funny' \
36
'git update-index --add "$p0" "$p2" &&
37
git ls-files >current &&
38
- git diff expected current'
38
+ test_cmp expected current'
39
40
t0=`git write-tree`
41
echo "$t0" >t0
@@ -48,14 +48,14 @@ EOF
48
test_expect_success 'git ls-files with-funny' \
49
'git update-index --add "$p1" &&
50
git ls-files >current &&
51
- git diff expected current'
51
+ test_cmp expected current'
52
53
echo 'just space
54
no-funny
55
tabs ," (dq) and spaces' >expected
56
test_expect_success 'git ls-files -z with-funny' \
57
'git ls-files -z | perl -pe y/\\000/\\012/ >current &&
58
- git diff expected current'
58
+ test_cmp expected current'
59
60
t1=`git write-tree`
61
echo "$t1" >t1
@@ -67,28 +67,28 @@ no-funny
67
EOF
68
test_expect_success 'git ls-tree with funny' \
69
'git ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current &&
70
- git diff expected current'
70
+ test_cmp expected current'
71
72
cat > expected <<\EOF
73
A "tabs\t,\" (dq) and spaces"
74
EOF
75
test_expect_success 'git diff-index with-funny' \
76
'git diff-index --name-status $t0 >current &&
77
- git diff expected current'
77
+ test_cmp expected current'
78
79
test_expect_success 'git diff-tree with-funny' \
80
'git diff-tree --name-status $t0 $t1 >current &&
81
- git diff expected current'
81
+ test_cmp expected current'
82
83
echo 'A
84
tabs ," (dq) and spaces' >expected
85
test_expect_success 'git diff-index -z with-funny' \
86
'git diff-index -z --name-status $t0 | perl -pe y/\\000/\\012/ >current &&
87
- git diff expected current'
87
+ test_cmp expected current'
88
89
test_expect_success 'git diff-tree -z with-funny' \
90
'git diff-tree -z --name-status $t0 $t1 | perl -pe y/\\000/\\012/ >current &&
91
- git diff expected current'
91
+ test_cmp expected current'
92
93
cat > expected <<\EOF
94
CNUM no-funny "tabs\t,\" (dq) and spaces"
@@ -96,7 +96,7 @@ EOF
96
test_expect_success 'git diff-tree -C with-funny' \
97
'git diff-tree -C --find-copies-harder --name-status \
98
$t0 $t1 | sed -e 's/^C[0-9]*/CNUM/' >current &&
99
- git diff expected current'
99
+ test_cmp expected current'
100
101
cat > expected <<\EOF
102
RNUM no-funny "tabs\t,\" (dq) and spaces"
@@ -105,7 +105,7 @@ test_expect_success 'git diff-tree delete with-funny' \
105
'git update-index --force-remove "$p0" &&
106
git diff-index -M --name-status \
107
$t0 | sed -e 's/^R[0-9]*/RNUM/' >current &&
108
- git diff expected current'
108
+ test_cmp expected current'
109
110
cat > expected <<\EOF
111
diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
@@ -116,7 +116,7 @@ EOF
116
test_expect_success 'git diff-tree delete with-funny' \
117
'git diff-index -M -p $t0 |
118
sed -e "s/index [0-9]*%/index NUM%/" >current &&
119
- git diff expected current'
119
+ test_cmp expected current'
120
121
chmod +x "$p1"
122
cat > expected <<\EOF
@@ -130,7 +130,7 @@ EOF
130
test_expect_success 'git diff-tree delete with-funny' \
131
'git diff-index -M -p $t0 |
132
sed -e "s/index [0-9]*%/index NUM%/" >current &&
133
- git diff expected current'
133
+ test_cmp expected current'
134
135
cat >expected <<\EOF
136
"tabs\t,\" (dq) and spaces"
@@ -139,7 +139,7 @@ EOF
139
test_expect_success 'git diff-tree rename with-funny applied' \
140
'git diff-index -M -p $t0 |
141
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
142
- git diff expected current'
142
+ test_cmp expected current'
143
144
cat > expected <<\EOF
145
no-funny
@@ -149,12 +149,12 @@ EOF
149
test_expect_success 'git diff-tree delete with-funny applied' \
150
'git diff-index -p $t0 |
151
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
152
- git diff expected current'
152
+ test_cmp expected current'
153
154
test_expect_success 'git apply non-git diff' \
155
'git diff-index -p $t0 |
156
sed -ne "/^[-+@]/p" |
157
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
158
- git diff expected current'
158
+ test_cmp expected current'
159
160
test_done
t/t3900-i18n-commit.sh
+1
-1
@@ -9,7 +9,7 @@ test_description='commit and log output encodings'
9
10
compare_with () {
11
git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' >current &&
12
- git diff current "$2"
12
+ test_cmp current "$2"
13
}
14
15
test_expect_success setup '
t/t4006-diff-mode.sh
+1
-1
@@ -38,6 +38,6 @@ echo ":100644 100755 X X M rezrov" >expected
38
39
test_expect_success \
40
'verify' \
41
- 'git diff expected check'
41
+ 'test_cmp expected check'
42
43
test_done
t/t4013-diff-various.sh
+1
-1
@@ -112,7 +112,7 @@ do
112
} >"$actual" &&
113
if test -f "$expect"
114
then
115
- git diff "$expect" "$actual" &&
115
+ test_cmp "$expect" "$actual" &&
116
rm -f "$actual"
117
else
118
# this is to help developing new tests.
t/t4014-format-patch.sh
+1
-1
@@ -226,7 +226,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
226
227
git format-patch --cover-letter -2 &&
228
sed -e "1,/A U Thor/d" -e "/^$/q" < 0000-cover-letter.patch > output &&
229
- git diff expect output
229
+ test_cmp expect output
230
231
'
232
t/t4015-diff-whitespace.sh
+6
-6
@@ -43,13 +43,13 @@ index adf3937..6edc172 100644
43
EOF
44
45
git diff > out
46
-test_expect_success "Ray's example without options" 'git diff expect out'
46
+test_expect_success "Ray's example without options" 'test_cmp expect out'
47
48
git diff -w > out
49
-test_expect_success "Ray's example with -w" 'git diff expect out'
49
+test_expect_success "Ray's example with -w" 'test_cmp expect out'
50
51
git diff -b > out
52
-test_expect_success "Ray's example with -b" 'git diff expect out'
52
+test_expect_success "Ray's example with -b" 'test_cmp expect out'
53
54
tr 'Q' '\015' << EOF > x
55
whitespace at beginning
@@ -90,14 +90,14 @@ index d99af23..8b32fb5 100644
90
+CR at end
91
EOF
92
git diff > out
93
-test_expect_success 'another test, without options' 'git diff expect out'
93
+test_expect_success 'another test, without options' 'test_cmp expect out'
94
95
cat << EOF > expect
96
diff --git a/x b/x
97
index d99af23..8b32fb5 100644
98
EOF
99
git diff -w > out
100
-test_expect_success 'another test, with -w' 'git diff expect out'
100
+test_expect_success 'another test, with -w' 'test_cmp expect out'
101
102
tr 'Q' '\015' << EOF > expect
103
diff --git a/x b/x
@@ -115,7 +115,7 @@ index d99af23..8b32fb5 100644
115
CR at endQ
116
EOF
117
git diff -b > out
118
-test_expect_success 'another test, with -b' 'git diff expect out'
118
+test_expect_success 'another test, with -b' 'test_cmp expect out'
119
120
test_expect_success 'check mixed spaces and tabs in indent' '
121
t/t4016-diff-quote.sh
+2
-2
@@ -49,7 +49,7 @@ cat >expect <<\EOF
49
EOF
50
test_expect_success 'git diff --summary -M HEAD' '
51
git diff --summary -M HEAD >actual &&
52
- git diff expect actual
52
+ test_cmp expect actual
53
'
54
55
cat >expect <<\EOF
@@ -64,7 +64,7 @@ cat >expect <<\EOF
64
EOF
65
test_expect_success 'git diff --stat -M HEAD' '
66
git diff --stat -M HEAD >actual &&
67
- git diff expect actual
67
+ test_cmp expect actual
68
'
69
70
test_done
t/t4018-diff-funcname.sh
+4
-4
@@ -33,13 +33,13 @@ EOF
33
sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java
34
35
test_expect_success 'default behaviour' '
36
- git diff Beer.java Beer-correct.java |
36
+ git diff --no-index Beer.java Beer-correct.java |
37
grep "^@@.*@@ public class Beer"
38
'
39
40
test_expect_success 'preset java pattern' '
41
echo "*.java diff=java" >.gitattributes &&
42
- git diff Beer.java Beer-correct.java |
42
+ git diff --no-index Beer.java Beer-correct.java |
43
grep "^@@.*@@ public static void main("
44
'
45
@@ -48,13 +48,13 @@ git config diff.java.funcname '!static
48
[^ ].*s.*'
49
50
test_expect_success 'custom pattern' '
51
- git diff Beer.java Beer-correct.java |
51
+ git diff --no-index Beer.java Beer-correct.java |
52
grep "^@@.*@@ int special;$"
53
'
54
55
test_expect_success 'last regexp must not be negated' '
56
git config diff.java.funcname "!static" &&
57
- ! git diff Beer.java Beer-correct.java
57
+ ! git diff --no-index Beer.java Beer-correct.java
58
'
59
60
test_done
t/t4100-apply-stat.sh
+7
-7
@@ -11,36 +11,36 @@ test_description='git apply --stat --summary test.
11
test_expect_success \
12
'rename' \
13
'git apply --stat --summary <../t4100/t-apply-1.patch >current &&
14
- git diff ../t4100/t-apply-1.expect current'
14
+ test_cmp ../t4100/t-apply-1.expect current'
15
16
test_expect_success \
17
'copy' \
18
'git apply --stat --summary <../t4100/t-apply-2.patch >current &&
19
- git diff ../t4100/t-apply-2.expect current'
19
+ test_cmp ../t4100/t-apply-2.expect current'
20
21
test_expect_success \
22
'rewrite' \
23
'git apply --stat --summary <../t4100/t-apply-3.patch >current &&
24
- git diff ../t4100/t-apply-3.expect current'
24
+ test_cmp ../t4100/t-apply-3.expect current'
25
26
test_expect_success \
27
'mode' \
28
'git apply --stat --summary <../t4100/t-apply-4.patch >current &&
29
- git diff ../t4100/t-apply-4.expect current'
29
+ test_cmp ../t4100/t-apply-4.expect current'
30
31
test_expect_success \
32
'non git' \
33
'git apply --stat --summary <../t4100/t-apply-5.patch >current &&
34
- git diff ../t4100/t-apply-5.expect current'
34
+ test_cmp ../t4100/t-apply-5.expect current'
35
36
test_expect_success \
37
'non git' \
38
'git apply --stat --summary <../t4100/t-apply-6.patch >current &&
39
- git diff ../t4100/t-apply-6.expect current'
39
+ test_cmp ../t4100/t-apply-6.expect current'
40
41
test_expect_success \
42
'non git' \
43
'git apply --stat --summary <../t4100/t-apply-7.patch >current &&
44
- git diff ../t4100/t-apply-7.expect current'
44
+ test_cmp ../t4100/t-apply-7.expect current'
45
46
test_done
t/t4104-apply-boundary.sh
+2
-2
@@ -90,7 +90,7 @@ do
90
cat '"$kind-patch.$with"'
91
(exit 1)
92
} &&
93
- git diff '"$kind"'-expect victim
93
+ test_cmp '"$kind"'-expect victim
94
'
95
done
96
done
@@ -108,7 +108,7 @@ do
108
cat '"$kind-ng.without"'
109
(exit 1)
110
} &&
111
- git diff '"$kind"'-expect victim
111
+ test_cmp '"$kind"'-expect victim
112
'
113
done
114
t/t4115-apply-symlink.sh
+2
-2
@@ -33,7 +33,7 @@ test_expect_success 'apply symlink patch' '
33
git checkout side &&
34
git apply patch &&
35
git diff-files -p >patched &&
36
- git diff patch patched
36
+ test_cmp patch patched
37
38
'
39
@@ -42,7 +42,7 @@ test_expect_success 'apply --index symlink patch' '
42
git checkout -f side &&
43
git apply --index patch &&
44
git diff-index --cached -p HEAD >patched &&
45
- git diff patch patched
45
+ test_cmp patch patched
46
47
'
48
t/t4116-apply-reverse.sh
+1
-1
@@ -42,7 +42,7 @@ test_expect_success 'apply in reverse' '
42
git reset --hard second &&
43
git apply --reverse --binary --index patch &&
44
git diff >diff &&
45
- git diff /dev/null diff
45
+ test_cmp /dev/null diff
46
47
'
48
t/t4117-apply-reject.sh
+6
-6
@@ -54,7 +54,7 @@ test_expect_success 'apply without --reject should fail' '
54
exit 1
55
fi
56
57
- git diff file1 saved.file1
57
+ test_cmp file1 saved.file1
58
'
59
60
test_expect_success 'apply without --reject should fail' '
@@ -65,7 +65,7 @@ test_expect_success 'apply without --reject should fail' '
65
exit 1
66
fi
67
68
- git diff file1 saved.file1
68
+ test_cmp file1 saved.file1
69
'
70
71
test_expect_success 'apply with --reject should fail but update the file' '
@@ -79,7 +79,7 @@ test_expect_success 'apply with --reject should fail but update the file' '
79
exit 1
80
fi
81
82
- git diff file1 expected &&
82
+ test_cmp file1 expected &&
83
84
cat file1.rej &&
85
@@ -105,7 +105,7 @@ test_expect_success 'apply with --reject should fail but update the file' '
105
echo "file1 still exists?"
106
exit 1
107
}
108
- git diff file2 expected &&
108
+ test_cmp file2 expected &&
109
110
cat file2.rej &&
111
@@ -132,7 +132,7 @@ test_expect_success 'the same test with --verbose' '
132
echo "file1 still exists?"
133
exit 1
134
}
135
- git diff file2 expected &&
135
+ test_cmp file2 expected &&
136
137
cat file2.rej &&
138
@@ -151,7 +151,7 @@ test_expect_success 'apply cleanly with --verbose' '
151
152
git apply --verbose patch.1 &&
153
154
- git diff file1 clean
154
+ test_cmp file1 clean
155
'
156
157
test_done
t/t4118-apply-empty-context.sh
+3
-3
@@ -38,7 +38,7 @@ test_expect_success 'apply --numstat' '
38
echo "0 1 file1" &&
39
echo "0 1 file2"
40
} >expect &&
41
- git diff expect actual
41
+ test_cmp expect actual
42
43
'
44
@@ -48,8 +48,8 @@ test_expect_success 'apply --apply' '
48
cat file2.orig >file2 &&
49
git update-index file1 file2 &&
50
git apply --index diff.output &&
51
- git diff file1.mods file1 &&
52
- git diff file2.mods file2
51
+ test_cmp file1.mods file1 &&
52
+ test_cmp file2.mods file2
53
'
54
55
test_done
t/t4200-rerere.sh
+3
-3
@@ -101,7 +101,7 @@ cat > expect << EOF
101
EOF
102
git rerere diff > out
103
104
-test_expect_success 'rerere diff' 'git diff expect out'
104
+test_expect_success 'rerere diff' 'test_cmp expect out'
105
106
cat > expect << EOF
107
a1
@@ -109,7 +109,7 @@ EOF
109
110
git rerere status > out
111
112
-test_expect_success 'rerere status' 'git diff expect out'
112
+test_expect_success 'rerere status' 'test_cmp expect out'
113
114
test_expect_success 'commit succeeds' \
115
"git commit -q -a -m 'prefer first over second'"
@@ -126,7 +126,7 @@ test_expect_success 'another conflicting merge' '
126
git show first:a1 | sed 's/To die: t/To die! T/' > expect
127
test_expect_success 'rerere kicked in' "! grep ======= a1"
128
129
-test_expect_success 'rerere prefers first change' 'git diff a1 expect'
129
+test_expect_success 'rerere prefers first change' 'test_cmp a1 expect'
130
131
rm $rr/postimage
132
echo "$sha1 a1" | perl -pe 'y/\012/\000/' > .git/rr-cache/MERGE_RR
t/t5305-include-tag.sh
+2
-2
@@ -50,7 +50,7 @@ test_expect_success 'check unpacked result (have commit, no tag)' '
50
test_must_fail git cat-file -e $tag &&
51
git rev-list --objects $commit
52
) >list.actual &&
53
- git diff list.expect list.actual
53
+ test_cmp list.expect list.actual
54
'
55
56
rm -rf clone.git
@@ -78,7 +78,7 @@ test_expect_success 'check unpacked result (have commit, have tag)' '
78
export GIT_DIR &&
79
git rev-list --objects $tag
80
) >list.actual &&
81
- git diff list.expect list.actual
81
+ test_cmp list.expect list.actual
82
'
83
84
test_done
t/t5400-send-pack.sh
+1
-1
@@ -110,7 +110,7 @@ test_expect_success \
110
cd .. &&
111
git update-ref refs/heads/master master^ || return 1
112
git-send-pack --force ./victim/.git/ master && return 1
113
- ! git diff .git/refs/heads/master victim/.git/refs/heads/master
113
+ ! test_cmp .git/refs/heads/master victim/.git/refs/heads/master
114
'
115
116
test_expect_success \
t/t5401-update-hooks.sh
+5
-5
@@ -83,23 +83,23 @@ test_expect_success 'hooks ran' '
83
test_expect_success 'pre-receive hook input' '
84
(echo $commit0 $commit1 refs/heads/master;
85
echo $commit1 $commit0 refs/heads/tofail
86
- ) | git diff - victim/.git/pre-receive.stdin
86
+ ) | test_cmp - victim/.git/pre-receive.stdin
87
'
88
89
test_expect_success 'update hook arguments' '
90
(echo refs/heads/master $commit0 $commit1;
91
echo refs/heads/tofail $commit1 $commit0
92
- ) | git diff - victim/.git/update.args
92
+ ) | test_cmp - victim/.git/update.args
93
'
94
95
test_expect_success 'post-receive hook input' '
96
echo $commit0 $commit1 refs/heads/master |
97
- git diff - victim/.git/post-receive.stdin
97
+ test_cmp - victim/.git/post-receive.stdin
98
'
99
100
test_expect_success 'post-update hook arguments' '
101
echo refs/heads/master |
102
- git diff - victim/.git/post-update.args
102
+ test_cmp - victim/.git/post-update.args
103
'
104
105
test_expect_success 'all hook stdin is /dev/null' '
@@ -130,7 +130,7 @@ STDERR post-update
130
EOF
131
test_expect_success 'send-pack stderr contains hook messages' '
132
grep ^STD send.err >actual &&
133
- git diff - actual <expect
133
+ test_cmp - actual <expect
134
'
135
136
test_done
t/t5503-tagfollow.sh
+4
-4
@@ -50,7 +50,7 @@ test_expect_success 'fetch A (new commit : 1 connection)' '
50
) &&
51
test -s $U &&
52
cut -d" " -f1,2 $U >actual &&
53
- git diff expect actual
53
+ test_cmp expect actual
54
'
55
56
test_expect_success "create tag T on A, create C on branch cat" '
@@ -82,7 +82,7 @@ test_expect_success 'fetch C, T (new branch, tag : 1 connection)' '
82
) &&
83
test -s $U &&
84
cut -d" " -f1,2 $U >actual &&
85
- git diff expect actual
85
+ test_cmp expect actual
86
'
87
88
test_expect_success "create commits O, B, tag S on B" '
@@ -118,7 +118,7 @@ test_expect_success 'fetch B, S (commit and tag : 1 connection)' '
118
) &&
119
test -s $U &&
120
cut -d" " -f1,2 $U >actual &&
121
- git diff expect actual
121
+ test_cmp expect actual
122
'
123
124
cat - <<EOF >expect
@@ -144,7 +144,7 @@ test_expect_success 'new clone fetch master and tags' '
144
) &&
145
test -s $U &&
146
cut -d" " -f1,2 $U >actual &&
147
- git diff expect actual
147
+ test_cmp expect actual
148
'
149
150
test_done
t/t5505-remote.sh
+5
-5
@@ -135,7 +135,7 @@ test_expect_success 'show' '
135
git config --add remote.origin.push \
136
+refs/tags/lastbackup &&
137
git remote show origin > output &&
138
- git diff expect output)
138
+ test_cmp expect output)
139
'
140
141
test_expect_success 'prune' '
@@ -179,7 +179,7 @@ test_expect_success 'update' '
179
git remote add apis ../mirror &&
180
git remote update &&
181
git branch -r > output &&
182
- git diff expect output)
182
+ test_cmp expect output)
183
184
'
185
@@ -206,7 +206,7 @@ test_expect_success 'update with arguments' '
206
git config remotes.titanus manduca &&
207
git remote update phobaeticus titanus &&
208
git branch -r > output &&
209
- git diff expect output)
209
+ test_cmp expect output)
210
211
'
212
@@ -229,7 +229,7 @@ test_expect_success 'update default' '
229
git config remote.drosophila.skipDefaultUpdate true &&
230
git remote update default &&
231
git branch -r > output &&
232
- git diff expect output)
232
+ test_cmp expect output)
233
234
'
235
@@ -249,7 +249,7 @@ test_expect_success 'update default (overridden, with funny whitespace)' '
249
git config remotes.default "$(printf "\t drosophila \n")" &&
250
git remote update default &&
251
git branch -r > output &&
252
- git diff expect output)
252
+ test_cmp expect output)
253
254
'
255
t/t5515-fetch-merge-logic.sh
+2
-2
@@ -151,7 +151,7 @@ do
151
git show-ref >"$actual_r" &&
152
if test -f "$expect_f"
153
then
154
- git diff -u "$expect_f" "$actual_f" &&
154
+ test_cmp "$expect_f" "$actual_f" &&
155
rm -f "$actual_f"
156
else
157
# this is to help developing new tests.
@@ -160,7 +160,7 @@ do
160
fi &&
161
if test -f "$expect_r"
162
then
163
- git diff -u "$expect_r" "$actual_r" &&
163
+ test_cmp "$expect_r" "$actual_r" &&
164
rm -f "$actual_r"
165
else
166
# this is to help developing new tests.
t/t6006-rev-list-format.sh
+1
-1
@@ -15,7 +15,7 @@ test_format() {
15
cat >expect.$1
16
test_expect_success "format $1" "
17
git rev-list --pretty=format:$2 master >output.$1 &&
18
-git diff expect.$1 output.$1
18
+test_cmp expect.$1 output.$1
19
"
20
}
21
t/t6023-merge-file.sh
+4
-4
@@ -63,7 +63,7 @@ test_expect_success "merge without conflict (missing LF at EOF)" \
63
"git merge-file test2.txt orig.txt new2.txt"
64
65
test_expect_success "merge result added missing LF" \
66
- "git diff test.txt test2.txt"
66
+ "test_cmp test.txt test2.txt"
67
68
cp test.txt backup.txt
69
test_expect_success "merge with conflicts" \
@@ -86,7 +86,7 @@ non timebo mala, quoniam tu mecum es:
86
virga tua et baculus tuus ipsa me consolata sunt.
87
EOF
88
89
-test_expect_success "expected conflict markers" "git diff test.txt expect.txt"
89
+test_expect_success "expected conflict markers" "test_cmp test.txt expect.txt"
90
91
cp backup.txt test.txt
92
test_expect_success "merge with conflicts, using -L" \
@@ -110,7 +110,7 @@ virga tua et baculus tuus ipsa me consolata sunt.
110
EOF
111
112
test_expect_success "expected conflict markers, with -L" \
113
- "git diff test.txt expect.txt"
113
+ "test_cmp test.txt expect.txt"
114
115
sed "s/ tu / TU /" < new1.txt > new5.txt
116
test_expect_success "conflict in removed tail" \
@@ -132,7 +132,7 @@ virga tua et baculus tuus ipsa me consolata sunt.
132
>>>>>>> new5.txt
133
EOF
134
135
-test_expect_success "expected conflict markers" "git diff expect out"
135
+test_expect_success "expected conflict markers" "test_cmp expect out"
136
137
test_expect_success 'binary files cannot be merged' '
138
! git merge-file -p orig.txt ../test4012.png new1.txt 2> merge.err &&
t/t6024-recursive-merge.sh
+2
-2
@@ -70,7 +70,7 @@ G
70
>>>>>>> G:a1
71
EOF
72
73
-test_expect_success "result contains a conflict" "git diff expect a1"
73
+test_expect_success "result contains a conflict" "test_cmp expect a1"
74
75
git ls-files --stage > out
76
cat > expect << EOF
@@ -79,7 +79,7 @@ cat > expect << EOF
79
100644 fd7923529855d0b274795ae3349c5e0438333979 3 a1
80
EOF
81
82
-test_expect_success "virtual trees were processed" "git diff expect out"
82
+test_expect_success "virtual trees were processed" "test_cmp expect out"
83
84
test_expect_success 'refuse to merge binary files' '
85
git reset --hard &&
t/t6029-merge-subtree.sh
+2
-2
@@ -57,7 +57,7 @@ test_expect_success 'initial merge' '
57
echo "100644 $o1 0 git-gui/git-gui.sh"
58
echo "100644 $o2 0 git.c"
59
) >expected &&
60
- git diff -u expected actual
60
+ test_cmp expected actual
61
'
62
63
test_expect_success 'merge update' '
@@ -73,7 +73,7 @@ test_expect_success 'merge update' '
73
echo "100644 $o3 0 git-gui/git-gui.sh"
74
echo "100644 $o2 0 git.c"
75
) >expected &&
76
- git diff -u expected actual
76
+ test_cmp expected actual
77
'
78
79
test_done
t/t6120-describe.sh
+1
-1
@@ -108,7 +108,7 @@ warning: tag 'A' is really 'Q' here
108
EOF
109
check_describe A-* HEAD
110
test_expect_success 'warning was displayed for Q' '
111
- git diff err.expect err.actual
111
+ test_cmp err.expect err.actual
112
'
113
test_expect_success 'rename tag Q back to A' '
114
mv .git/refs/tags/Q .git/refs/tags/A
t/t6200-fmt-merge-msg.sh
+8
-8
@@ -79,7 +79,7 @@ test_expect_success 'merge-msg test #1' '
79
git fetch . left &&
80
81
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
82
- git diff actual expected
82
+ test_cmp expected actual
83
'
84
85
cat >expected <<EOF
@@ -92,7 +92,7 @@ test_expect_success 'merge-msg test #2' '
92
git fetch ../"$test" left &&
93
94
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
95
- git diff actual expected
95
+ test_cmp expected actual
96
'
97
98
cat >expected <<\EOF
@@ -117,7 +117,7 @@ test_expect_success 'merge-msg test #3-1' '
117
git fetch . left &&
118
119
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
120
- git diff actual expected
120
+ test_cmp expected actual
121
'
122
123
test_expect_success 'merge-msg test #3-2' '
@@ -131,7 +131,7 @@ test_expect_success 'merge-msg test #3-2' '
131
git fetch . left &&
132
133
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
134
- git diff actual expected
134
+ test_cmp expected actual
135
'
136
137
cat >expected <<\EOF
@@ -163,7 +163,7 @@ test_expect_success 'merge-msg test #4-1' '
163
git fetch . left right &&
164
165
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
166
- git diff actual expected
166
+ test_cmp expected actual
167
'
168
169
test_expect_success 'merge-msg test #4-2' '
@@ -177,7 +177,7 @@ test_expect_success 'merge-msg test #4-2' '
177
git fetch . left right &&
178
179
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
180
- git diff actual expected
180
+ test_cmp expected actual
181
'
182
183
test_expect_success 'merge-msg test #5-1' '
@@ -191,7 +191,7 @@ test_expect_success 'merge-msg test #5-1' '
191
git fetch . left right &&
192
193
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
194
- git diff actual expected
194
+ test_cmp expected actual
195
'
196
197
test_expect_success 'merge-msg test #5-2' '
@@ -205,7 +205,7 @@ test_expect_success 'merge-msg test #5-2' '
205
git fetch . left right &&
206
207
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
208
- git diff actual expected
208
+ test_cmp expected actual
209
'
210
211
test_done
t/t6300-for-each-ref.sh
+12
-12
@@ -75,14 +75,14 @@ EOF
75
test_expect_success 'Check unformatted date fields output' '
76
(git for-each-ref --shell --format="%(refname) %(committerdate) %(authordate)" refs/heads &&
77
git for-each-ref --shell --format="%(refname) %(taggerdate)" refs/tags) >actual &&
78
- git diff expected actual
78
+ test_cmp expected actual
79
'
80
81
test_expect_success 'Check format "default" formatted date fields output' '
82
f=default &&
83
(git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads &&
84
git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual &&
85
- git diff expected actual
85
+ test_cmp expected actual
86
'
87
88
# Don't know how to do relative check because I can't know when this script
@@ -109,7 +109,7 @@ test_expect_success 'Check format "short" date fields output' '
109
f=short &&
110
(git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads &&
111
git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual &&
112
- git diff expected actual
112
+ test_cmp expected actual
113
'
114
115
cat >expected <<\EOF
@@ -121,7 +121,7 @@ test_expect_success 'Check format "local" date fields output' '
121
f=local &&
122
(git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads &&
123
git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual &&
124
- git diff expected actual
124
+ test_cmp expected actual
125
'
126
127
cat >expected <<\EOF
@@ -133,7 +133,7 @@ test_expect_success 'Check format "iso8601" date fields output' '
133
f=iso8601 &&
134
(git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads &&
135
git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual &&
136
- git diff expected actual
136
+ test_cmp expected actual
137
'
138
139
cat >expected <<\EOF
@@ -145,7 +145,7 @@ test_expect_success 'Check format "rfc2822" date fields output' '
145
f=rfc2822 &&
146
(git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads &&
147
git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual &&
148
- git diff expected actual
148
+ test_cmp expected actual
149
'
150
151
cat >expected <<\EOF
@@ -155,7 +155,7 @@ EOF
155
156
test_expect_success 'Verify ascending sort' '
157
git-for-each-ref --format="%(refname)" --sort=refname >actual &&
158
- git diff expected actual
158
+ test_cmp expected actual
159
'
160
161
@@ -166,7 +166,7 @@ EOF
166
167
test_expect_success 'Verify descending sort' '
168
git-for-each-ref --format="%(refname)" --sort=-refname >actual &&
169
- git diff expected actual
169
+ test_cmp expected actual
170
'
171
172
cat >expected <<\EOF
@@ -176,17 +176,17 @@ EOF
176
177
test_expect_success 'Quoting style: shell' '
178
git for-each-ref --shell --format="%(refname)" >actual &&
179
- git diff expected actual
179
+ test_cmp expected actual
180
'
181
182
test_expect_success 'Quoting style: perl' '
183
git for-each-ref --perl --format="%(refname)" >actual &&
184
- git diff expected actual
184
+ test_cmp expected actual
185
'
186
187
test_expect_success 'Quoting style: python' '
188
git for-each-ref --python --format="%(refname)" >actual &&
189
- git diff expected actual
189
+ test_cmp expected actual
190
'
191
192
cat >expected <<\EOF
@@ -196,7 +196,7 @@ EOF
196
197
test_expect_success 'Quoting style: tcl' '
198
git for-each-ref --tcl --format="%(refname)" >actual &&
199
- git diff expected actual
199
+ test_cmp expected actual
200
'
201
202
for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do
t/t7003-filter-branch.sh
+2
-2
@@ -224,7 +224,7 @@ test_expect_success 'Tag name filtering retains tag message' '
224
git cat-file tag T > expect &&
225
git filter-branch -f --tag-name-filter cat &&
226
git cat-file tag T > actual &&
227
- git diff expect actual
227
+ test_cmp expect actual
228
'
229
230
faux_gpg_tag='object XXXXXX
@@ -248,7 +248,7 @@ test_expect_success 'Tag name filtering strips gpg signature' '
248
echo "$faux_gpg_tag" | sed -e s/XXXXXX/$sha1/ | head -n 6 > expect &&
249
git filter-branch -f --tag-name-filter cat &&
250
git cat-file tag S > actual &&
251
- git diff expect actual
251
+ test_cmp expect actual
252
'
253
254
test_done
t/t7004-tag.sh
+105
-105
@@ -116,9 +116,9 @@ mytag
116
EOF
117
test_expect_success \
118
'trying to delete tags without params should succeed and do nothing' '
119
- git tag -l > actual && git diff expect actual &&
119
+ git tag -l > actual && test_cmp expect actual &&
120
git-tag -d &&
121
- git tag -l > actual && git diff expect actual
121
+ git tag -l > actual && test_cmp expect actual
122
'
123
124
test_expect_success \
@@ -173,9 +173,9 @@ test_expect_success 'listing all tags should print them ordered' '
173
git tag v1.0 &&
174
git tag t210 &&
175
git tag -l > actual &&
176
- git diff expect actual &&
176
+ test_cmp expect actual &&
177
git tag > actual &&
178
- git diff expect actual
178
+ test_cmp expect actual
179
'
180
181
cat >expect <<EOF
@@ -186,7 +186,7 @@ EOF
186
test_expect_success \
187
'listing tags with substring as pattern must print those matching' '
188
git-tag -l "*a*" > actual &&
189
- git diff expect actual
189
+ test_cmp expect actual
190
'
191
192
cat >expect <<EOF
@@ -196,7 +196,7 @@ EOF
196
test_expect_success \
197
'listing tags with a suffix as pattern must print those matching' '
198
git-tag -l "*.1" > actual &&
199
- git diff expect actual
199
+ test_cmp expect actual
200
'
201
202
cat >expect <<EOF
@@ -206,7 +206,7 @@ EOF
206
test_expect_success \
207
'listing tags with a prefix as pattern must print those matching' '
208
git-tag -l "t21*" > actual &&
209
- git diff expect actual
209
+ test_cmp expect actual
210
'
211
212
cat >expect <<EOF
@@ -215,7 +215,7 @@ EOF
215
test_expect_success \
216
'listing tags using a name as pattern must print that one matching' '
217
git-tag -l a1 > actual &&
218
- git diff expect actual
218
+ test_cmp expect actual
219
'
220
221
cat >expect <<EOF
@@ -224,7 +224,7 @@ EOF
224
test_expect_success \
225
'listing tags using a name as pattern must print that one matching' '
226
git-tag -l v1.0 > actual &&
227
- git diff expect actual
227
+ test_cmp expect actual
228
'
229
230
cat >expect <<EOF
@@ -234,14 +234,14 @@ EOF
234
test_expect_success \
235
'listing tags with ? in the pattern should print those matching' '
236
git-tag -l "v1.?.?" > actual &&
237
- git diff expect actual
237
+ test_cmp expect actual
238
'
239
240
>expect
241
test_expect_success \
242
'listing tags using v.* should print nothing because none have v.' '
243
git-tag -l "v.*" > actual &&
244
- git diff expect actual
244
+ test_cmp expect actual
245
'
246
247
cat >expect <<EOF
@@ -253,7 +253,7 @@ EOF
253
test_expect_success \
254
'listing tags using v* should print only those having v' '
255
git-tag -l "v*" > actual &&
256
- git diff expect actual
256
+ test_cmp expect actual
257
'
258
259
# creating and verifying lightweight tags:
@@ -302,7 +302,7 @@ test_expect_success \
302
'creating an annotated tag with -m message should succeed' '
303
git-tag -m "A message" annotated-tag &&
304
get_tag_msg annotated-tag >actual &&
305
- git diff expect actual
305
+ test_cmp expect actual
306
'
307
308
cat >msgfile <<EOF
@@ -315,7 +315,7 @@ test_expect_success \
315
'creating an annotated tag with -F messagefile should succeed' '
316
git-tag -F msgfile file-annotated-tag &&
317
get_tag_msg file-annotated-tag >actual &&
318
- git diff expect actual
318
+ test_cmp expect actual
319
'
320
321
cat >inputmsg <<EOF
@@ -327,7 +327,7 @@ cat inputmsg >>expect
327
test_expect_success 'creating an annotated tag with -F - should succeed' '
328
git-tag -F - stdin-annotated-tag <inputmsg &&
329
get_tag_msg stdin-annotated-tag >actual &&
330
- git diff expect actual
330
+ test_cmp expect actual
331
'
332
333
test_expect_success \
@@ -358,7 +358,7 @@ test_expect_success \
358
'creating a tag with an empty -m message should succeed' '
359
git-tag -m "" empty-annotated-tag &&
360
get_tag_msg empty-annotated-tag >actual &&
361
- git diff expect actual
361
+ test_cmp expect actual
362
'
363
364
>emptyfile
@@ -367,7 +367,7 @@ test_expect_success \
367
'creating a tag with an empty -F messagefile should succeed' '
368
git-tag -F emptyfile emptyfile-annotated-tag &&
369
get_tag_msg emptyfile-annotated-tag >actual &&
370
- git diff expect actual
370
+ test_cmp expect actual
371
'
372
373
printf '\n\n \n\t\nLeading blank lines\n' >blanksfile
@@ -388,7 +388,7 @@ test_expect_success \
388
'extra blanks in the message for an annotated tag should be removed' '
389
git-tag -F blanksfile blanks-annotated-tag &&
390
get_tag_msg blanks-annotated-tag >actual &&
391
- git diff expect actual
391
+ test_cmp expect actual
392
'
393
394
get_tag_header blank-annotated-tag $commit commit $time >expect
@@ -396,7 +396,7 @@ test_expect_success \
396
'creating a tag with blank -m message with spaces should succeed' '
397
git-tag -m " " blank-annotated-tag &&
398
get_tag_msg blank-annotated-tag >actual &&
399
- git diff expect actual
399
+ test_cmp expect actual
400
'
401
402
echo ' ' >blankfile
@@ -407,7 +407,7 @@ test_expect_success \
407
'creating a tag with blank -F messagefile with spaces should succeed' '
408
git-tag -F blankfile blankfile-annotated-tag &&
409
get_tag_msg blankfile-annotated-tag >actual &&
410
- git diff expect actual
410
+ test_cmp expect actual
411
'
412
413
printf ' ' >blanknonlfile
@@ -416,7 +416,7 @@ test_expect_success \
416
'creating a tag with -F file of spaces and no newline should succeed' '
417
git-tag -F blanknonlfile blanknonlfile-annotated-tag &&
418
get_tag_msg blanknonlfile-annotated-tag >actual &&
419
- git diff expect actual
419
+ test_cmp expect actual
420
'
421
422
# messages with commented lines:
@@ -451,7 +451,7 @@ test_expect_success \
451
'creating a tag using a -F messagefile with #comments should succeed' '
452
git-tag -F commentsfile comments-annotated-tag &&
453
get_tag_msg comments-annotated-tag >actual &&
454
- git diff expect actual
454
+ test_cmp expect actual
455
'
456
457
get_tag_header comment-annotated-tag $commit commit $time >expect
@@ -459,7 +459,7 @@ test_expect_success \
459
'creating a tag with a #comment in the -m message should succeed' '
460
git-tag -m "#comment" comment-annotated-tag &&
461
get_tag_msg comment-annotated-tag >actual &&
462
- git diff expect actual
462
+ test_cmp expect actual
463
'
464
465
echo '#comment' >commentfile
@@ -470,7 +470,7 @@ test_expect_success \
470
'creating a tag with #comments in the -F messagefile should succeed' '
471
git-tag -F commentfile commentfile-annotated-tag &&
472
get_tag_msg commentfile-annotated-tag >actual &&
473
- git diff expect actual
473
+ test_cmp expect actual
474
'
475
476
printf '#comment' >commentnonlfile
@@ -479,7 +479,7 @@ test_expect_success \
479
'creating a tag with a file of #comment and no newline should succeed' '
480
git-tag -F commentnonlfile commentnonlfile-annotated-tag &&
481
get_tag_msg commentnonlfile-annotated-tag >actual &&
482
- git diff expect actual
482
+ test_cmp expect actual
483
'
484
485
# listing messages for annotated non-signed tags:
@@ -490,23 +490,23 @@ test_expect_success \
490
491
echo "tag-one-line" >expect &&
492
git-tag -l | grep "^tag-one-line" >actual &&
493
- git diff expect actual &&
493
+ test_cmp expect actual &&
494
git-tag -n0 -l | grep "^tag-one-line" >actual &&
495
- git diff expect actual &&
495
+ test_cmp expect actual &&
496
git-tag -n0 -l tag-one-line >actual &&
497
- git diff expect actual &&
497
+ test_cmp expect actual &&
498
499
echo "tag-one-line A msg" >expect &&
500
git-tag -n1 -l | grep "^tag-one-line" >actual &&
501
- git diff expect actual &&
501
+ test_cmp expect actual &&
502
git-tag -n -l | grep "^tag-one-line" >actual &&
503
- git diff expect actual &&
503
+ test_cmp expect actual &&
504
git-tag -n1 -l tag-one-line >actual &&
505
- git diff expect actual &&
505
+ test_cmp expect actual &&
506
git-tag -n2 -l tag-one-line >actual &&
507
- git diff expect actual &&
507
+ test_cmp expect actual &&
508
git-tag -n999 -l tag-one-line >actual &&
509
- git diff expect actual
509
+ test_cmp expect actual
510
'
511
512
test_expect_success \
@@ -515,23 +515,23 @@ test_expect_success \
515
516
echo "tag-zero-lines" >expect &&
517
git-tag -l | grep "^tag-zero-lines" >actual &&
518
- git diff expect actual &&
518
+ test_cmp expect actual &&
519
git-tag -n0 -l | grep "^tag-zero-lines" >actual &&
520
- git diff expect actual &&
520
+ test_cmp expect actual &&
521
git-tag -n0 -l tag-zero-lines >actual &&
522
- git diff expect actual &&
522
+ test_cmp expect actual &&
523
524
echo "tag-zero-lines " >expect &&
525
git-tag -n1 -l | grep "^tag-zero-lines" >actual &&
526
- git diff expect actual &&
526
+ test_cmp expect actual &&
527
git-tag -n -l | grep "^tag-zero-lines" >actual &&
528
- git diff expect actual &&
528
+ test_cmp expect actual &&
529
git-tag -n1 -l tag-zero-lines >actual &&
530
- git diff expect actual &&
530
+ test_cmp expect actual &&
531
git-tag -n2 -l tag-zero-lines >actual &&
532
- git diff expect actual &&
532
+ test_cmp expect actual &&
533
git-tag -n999 -l tag-zero-lines >actual &&
534
- git diff expect actual
534
+ test_cmp expect actual
535
'
536
537
echo 'tag line one' >annotagmsg
@@ -543,39 +543,39 @@ test_expect_success \
543
544
echo "tag-lines" >expect &&
545
git-tag -l | grep "^tag-lines" >actual &&
546
- git diff expect actual &&
546
+ test_cmp expect actual &&
547
git-tag -n0 -l | grep "^tag-lines" >actual &&
548
- git diff expect actual &&
548
+ test_cmp expect actual &&
549
git-tag -n0 -l tag-lines >actual &&
550
- git diff expect actual &&
550
+ test_cmp expect actual &&
551
552
echo "tag-lines tag line one" >expect &&
553
git-tag -n1 -l | grep "^tag-lines" >actual &&
554
- git diff expect actual &&
554
+ test_cmp expect actual &&
555
git-tag -n -l | grep "^tag-lines" >actual &&
556
- git diff expect actual &&
556
+ test_cmp expect actual &&
557
git-tag -n1 -l tag-lines >actual &&
558
- git diff expect actual &&
558
+ test_cmp expect actual &&
559
560
echo " tag line two" >>expect &&
561
git-tag -n2 -l | grep "^ *tag.line" >actual &&
562
- git diff expect actual &&
562
+ test_cmp expect actual &&
563
git-tag -n2 -l tag-lines >actual &&
564
- git diff expect actual &&
564
+ test_cmp expect actual &&
565
566
echo " tag line three" >>expect &&
567
git-tag -n3 -l | grep "^ *tag.line" >actual &&
568
- git diff expect actual &&
568
+ test_cmp expect actual &&
569
git-tag -n3 -l tag-lines >actual &&
570
- git diff expect actual &&
570
+ test_cmp expect actual &&
571
git-tag -n4 -l | grep "^ *tag.line" >actual &&
572
- git diff expect actual &&
572
+ test_cmp expect actual &&
573
git-tag -n4 -l tag-lines >actual &&
574
- git diff expect actual &&
574
+ test_cmp expect actual &&
575
git-tag -n99 -l | grep "^ *tag.line" >actual &&
576
- git diff expect actual &&
576
+ test_cmp expect actual &&
577
git-tag -n99 -l tag-lines >actual &&
578
- git diff expect actual
578
+ test_cmp expect actual
579
'
580
581
# subsequent tests require gpg; check if it is available
@@ -635,7 +635,7 @@ echo '-----BEGIN PGP SIGNATURE-----' >>expect
635
test_expect_success 'creating a signed tag with -m message should succeed' '
636
git-tag -s -m "A signed tag message" signed-tag &&
637
get_tag_msg signed-tag >actual &&
638
- git diff expect actual
638
+ test_cmp expect actual
639
'
640
641
get_tag_header u-signed-tag $commit commit $time >expect
@@ -645,7 +645,7 @@ test_expect_success 'sign with a given key id' '
645
646
git tag -u committer@example.com -m "Another message" u-signed-tag &&
647
get_tag_msg u-signed-tag >actual &&
648
- git diff expect actual
648
+ test_cmp expect actual
649
650
'
651
@@ -675,7 +675,7 @@ echo '-----BEGIN PGP SIGNATURE-----' >>expect
675
test_expect_success '-u implies signed tag' '
676
GIT_EDITOR=./fakeeditor git-tag -u CDDE430D implied-sign &&
677
get_tag_msg implied-sign >actual &&
678
- git diff expect actual
678
+ test_cmp expect actual
679
'
680
681
cat >sigmsgfile <<EOF
@@ -689,7 +689,7 @@ test_expect_success \
689
'creating a signed tag with -F messagefile should succeed' '
690
git-tag -s -F sigmsgfile file-signed-tag &&
691
get_tag_msg file-signed-tag >actual &&
692
- git diff expect actual
692
+ test_cmp expect actual
693
'
694
695
cat >siginputmsg <<EOF
@@ -702,7 +702,7 @@ echo '-----BEGIN PGP SIGNATURE-----' >>expect
702
test_expect_success 'creating a signed tag with -F - should succeed' '
703
git-tag -s -F - stdin-signed-tag <siginputmsg &&
704
get_tag_msg stdin-signed-tag >actual &&
705
- git diff expect actual
705
+ test_cmp expect actual
706
'
707
708
get_tag_header implied-annotate $commit commit $time >expect
@@ -711,7 +711,7 @@ echo '-----BEGIN PGP SIGNATURE-----' >>expect
711
test_expect_success '-s implies annotated tag' '
712
GIT_EDITOR=./fakeeditor git-tag -s implied-annotate &&
713
get_tag_msg implied-annotate >actual &&
714
- git diff expect actual
714
+ test_cmp expect actual
715
'
716
717
test_expect_success \
@@ -752,7 +752,7 @@ test_expect_success \
752
'creating a signed tag with an empty -m message should succeed' '
753
git-tag -s -m "" empty-signed-tag &&
754
get_tag_msg empty-signed-tag >actual &&
755
- git diff expect actual &&
755
+ test_cmp expect actual &&
756
git-tag -v empty-signed-tag
757
'
758
@@ -763,7 +763,7 @@ test_expect_success \
763
'creating a signed tag with an empty -F messagefile should succeed' '
764
git-tag -s -F sigemptyfile emptyfile-signed-tag &&
765
get_tag_msg emptyfile-signed-tag >actual &&
766
- git diff expect actual &&
766
+ test_cmp expect actual &&
767
git-tag -v emptyfile-signed-tag
768
'
769
@@ -786,7 +786,7 @@ test_expect_success \
786
'extra blanks in the message for a signed tag should be removed' '
787
git-tag -s -F sigblanksfile blanks-signed-tag &&
788
get_tag_msg blanks-signed-tag >actual &&
789
- git diff expect actual &&
789
+ test_cmp expect actual &&
790
git-tag -v blanks-signed-tag
791
'
792
@@ -796,7 +796,7 @@ test_expect_success \
796
'creating a signed tag with a blank -m message should succeed' '
797
git-tag -s -m " " blank-signed-tag &&
798
get_tag_msg blank-signed-tag >actual &&
799
- git diff expect actual &&
799
+ test_cmp expect actual &&
800
git-tag -v blank-signed-tag
801
'
802
@@ -809,7 +809,7 @@ test_expect_success \
809
'creating a signed tag with blank -F file with spaces should succeed' '
810
git-tag -s -F sigblankfile blankfile-signed-tag &&
811
get_tag_msg blankfile-signed-tag >actual &&
812
- git diff expect actual &&
812
+ test_cmp expect actual &&
813
git-tag -v blankfile-signed-tag
814
'
815
@@ -820,7 +820,7 @@ test_expect_success \
820
'creating a signed tag with spaces and no newline should succeed' '
821
git-tag -s -F sigblanknonlfile blanknonlfile-signed-tag &&
822
get_tag_msg blanknonlfile-signed-tag >actual &&
823
- git diff expect actual &&
823
+ test_cmp expect actual &&
824
git-tag -v signed-tag
825
'
826
@@ -857,7 +857,7 @@ test_expect_success \
857
'creating a signed tag with a -F file with #comments should succeed' '
858
git-tag -s -F sigcommentsfile comments-signed-tag &&
859
get_tag_msg comments-signed-tag >actual &&
860
- git diff expect actual &&
860
+ test_cmp expect actual &&
861
git-tag -v comments-signed-tag
862
'
863
@@ -867,7 +867,7 @@ test_expect_success \
867
'creating a signed tag with #commented -m message should succeed' '
868
git-tag -s -m "#comment" comment-signed-tag &&
869
get_tag_msg comment-signed-tag >actual &&
870
- git diff expect actual &&
870
+ test_cmp expect actual &&
871
git-tag -v comment-signed-tag
872
'
873
@@ -880,7 +880,7 @@ test_expect_success \
880
'creating a signed tag with #commented -F messagefile should succeed' '
881
git-tag -s -F sigcommentfile commentfile-signed-tag &&
882
get_tag_msg commentfile-signed-tag >actual &&
883
- git diff expect actual &&
883
+ test_cmp expect actual &&
884
git-tag -v commentfile-signed-tag
885
'
886
@@ -891,7 +891,7 @@ test_expect_success \
891
'creating a signed tag with a #comment and no newline should succeed' '
892
git-tag -s -F sigcommentnonlfile commentnonlfile-signed-tag &&
893
get_tag_msg commentnonlfile-signed-tag >actual &&
894
- git diff expect actual &&
894
+ test_cmp expect actual &&
895
git-tag -v commentnonlfile-signed-tag
896
'
897
@@ -903,23 +903,23 @@ test_expect_success \
903
904
echo "stag-one-line" >expect &&
905
git-tag -l | grep "^stag-one-line" >actual &&
906
- git diff expect actual &&
906
+ test_cmp expect actual &&
907
git-tag -n0 -l | grep "^stag-one-line" >actual &&
908
- git diff expect actual &&
908
+ test_cmp expect actual &&
909
git-tag -n0 -l stag-one-line >actual &&
910
- git diff expect actual &&
910
+ test_cmp expect actual &&
911
912
echo "stag-one-line A message line signed" >expect &&
913
git-tag -n1 -l | grep "^stag-one-line" >actual &&
914
- git diff expect actual &&
914
+ test_cmp expect actual &&
915
git-tag -n -l | grep "^stag-one-line" >actual &&
916
- git diff expect actual &&
916
+ test_cmp expect actual &&
917
git-tag -n1 -l stag-one-line >actual &&
918
- git diff expect actual &&
918
+ test_cmp expect actual &&
919
git-tag -n2 -l stag-one-line >actual &&
920
- git diff expect actual &&
920
+ test_cmp expect actual &&
921
git-tag -n999 -l stag-one-line >actual &&
922
- git diff expect actual
922
+ test_cmp expect actual
923
'
924
925
test_expect_success \
@@ -928,23 +928,23 @@ test_expect_success \
928
929
echo "stag-zero-lines" >expect &&
930
git-tag -l | grep "^stag-zero-lines" >actual &&
931
- git diff expect actual &&
931
+ test_cmp expect actual &&
932
git-tag -n0 -l | grep "^stag-zero-lines" >actual &&
933
- git diff expect actual &&
933
+ test_cmp expect actual &&
934
git-tag -n0 -l stag-zero-lines >actual &&
935
- git diff expect actual &&
935
+ test_cmp expect actual &&
936
937
echo "stag-zero-lines " >expect &&
938
git-tag -n1 -l | grep "^stag-zero-lines" >actual &&
939
- git diff expect actual &&
939
+ test_cmp expect actual &&
940
git-tag -n -l | grep "^stag-zero-lines" >actual &&
941
- git diff expect actual &&
941
+ test_cmp expect actual &&
942
git-tag -n1 -l stag-zero-lines >actual &&
943
- git diff expect actual &&
943
+ test_cmp expect actual &&
944
git-tag -n2 -l stag-zero-lines >actual &&
945
- git diff expect actual &&
945
+ test_cmp expect actual &&
946
git-tag -n999 -l stag-zero-lines >actual &&
947
- git diff expect actual
947
+ test_cmp expect actual
948
'
949
950
echo 'stag line one' >sigtagmsg
@@ -956,39 +956,39 @@ test_expect_success \
956
957
echo "stag-lines" >expect &&
958
git-tag -l | grep "^stag-lines" >actual &&
959
- git diff expect actual &&
959
+ test_cmp expect actual &&
960
git-tag -n0 -l | grep "^stag-lines" >actual &&
961
- git diff expect actual &&
961
+ test_cmp expect actual &&
962
git-tag -n0 -l stag-lines >actual &&
963
- git diff expect actual &&
963
+ test_cmp expect actual &&
964
965
echo "stag-lines stag line one" >expect &&
966
git-tag -n1 -l | grep "^stag-lines" >actual &&
967
- git diff expect actual &&
967
+ test_cmp expect actual &&
968
git-tag -n -l | grep "^stag-lines" >actual &&
969
- git diff expect actual &&
969
+ test_cmp expect actual &&
970
git-tag -n1 -l stag-lines >actual &&
971
- git diff expect actual &&
971
+ test_cmp expect actual &&
972
973
echo " stag line two" >>expect &&
974
git-tag -n2 -l | grep "^ *stag.line" >actual &&
975
- git diff expect actual &&
975
+ test_cmp expect actual &&
976
git-tag -n2 -l stag-lines >actual &&
977
- git diff expect actual &&
977
+ test_cmp expect actual &&
978
979
echo " stag line three" >>expect &&
980
git-tag -n3 -l | grep "^ *stag.line" >actual &&
981
- git diff expect actual &&
981
+ test_cmp expect actual &&
982
git-tag -n3 -l stag-lines >actual &&
983
- git diff expect actual &&
983
+ test_cmp expect actual &&
984
git-tag -n4 -l | grep "^ *stag.line" >actual &&
985
- git diff expect actual &&
985
+ test_cmp expect actual &&
986
git-tag -n4 -l stag-lines >actual &&
987
- git diff expect actual &&
987
+ test_cmp expect actual &&
988
git-tag -n99 -l | grep "^ *stag.line" >actual &&
989
- git diff expect actual &&
989
+ test_cmp expect actual &&
990
git-tag -n99 -l stag-lines >actual &&
991
- git diff expect actual
991
+ test_cmp expect actual
992
'
993
994
# tags pointing to objects different from commits:
@@ -1004,7 +1004,7 @@ test_expect_success \
1004
'creating a signed tag pointing to a tree should succeed' '
1005
git-tag -s -m "A message for a tree" tree-signed-tag HEAD^{tree} &&
1006
get_tag_msg tree-signed-tag >actual &&
1007
- git diff expect actual
1007
+ test_cmp expect actual
1008
'
1009
1010
get_tag_header blob-signed-tag $blob blob $time >expect
@@ -1014,7 +1014,7 @@ test_expect_success \
1014
'creating a signed tag pointing to a blob should succeed' '
1015
git-tag -s -m "A message for a blob" blob-signed-tag HEAD:foo &&
1016
get_tag_msg blob-signed-tag >actual &&
1017
- git diff expect actual
1017
+ test_cmp expect actual
1018
'
1019
1020
get_tag_header tag-signed-tag $tag tag $time >expect
@@ -1024,7 +1024,7 @@ test_expect_success \
1024
'creating a signed tag pointing to another tag should succeed' '
1025
git-tag -s -m "A message for another tag" tag-signed-tag signed-tag &&
1026
get_tag_msg tag-signed-tag >actual &&
1027
- git diff expect actual
1027
+ test_cmp expect actual
1028
'
1029
1030
# try to sign with bad user.signingkey
@@ -1064,7 +1064,7 @@ test_expect_success \
1064
git tag -a -m "An annotation to be reused" reuse &&
1065
GIT_EDITOR=true git tag -f -a reuse &&
1066
get_tag_msg reuse >actual &&
1067
- git diff expect actual
1067
+ test_cmp expect actual
1068
'
1069
1070
test_done
t/t7102-reset.sh
+6
-6
@@ -34,13 +34,13 @@ test_expect_success 'creating initial files and commits' '
34
35
check_changes () {
36
test "$(git rev-parse HEAD)" = "$1" &&
37
- git diff | git diff .diff_expect - &&
38
- git diff --cached | git diff .cached_expect - &&
37
+ git diff | test_cmp .diff_expect - &&
38
+ git diff --cached | test_cmp .cached_expect - &&
39
for FILE in *
40
do
41
echo $FILE':'
42
cat $FILE || return
43
- done | git diff .cat_expect -
43
+ done | test_cmp .cat_expect -
44
}
45
46
>.diff_expect
@@ -390,9 +390,9 @@ test_expect_success 'test --mixed <paths>' '
390
git add file1 file3 file4 &&
391
! git reset HEAD -- file1 file2 file3 &&
392
git diff > output &&
393
- git diff output expect &&
393
+ test_cmp output expect &&
394
git diff --cached > output &&
395
- git diff output cached_expect
395
+ test_cmp output cached_expect
396
'
397
398
test_expect_success 'test resetting the index at give paths' '
@@ -425,7 +425,7 @@ EOF
425
test_expect_success '--mixed refreshes the index' '
426
echo 123 >> file2 &&
427
git reset --mixed HEAD > output &&
428
- git diff --exit-code expect output
428
+ test_cmp expect output
429
'
430
431
test_done
t/t7502-status.sh
+3
-3
@@ -63,7 +63,7 @@ EOF
63
test_expect_success 'status (2)' '
64
65
git status > output &&
66
- git diff expect output
66
+ test_cmp expect output
67
68
'
69
@@ -93,7 +93,7 @@ EOF
93
test_expect_success 'status with relative paths' '
94
95
(cd dir1 && git status) > output &&
96
- git diff expect output
96
+ test_cmp expect output
97
98
'
99
@@ -124,7 +124,7 @@ test_expect_success 'status without relative paths' '
124
125
git config status.relativePaths false
126
(cd dir1 && git status) > output &&
127
- git diff expect output
127
+ test_cmp expect output
128
129
'
130
t/t9100-git-svn-basic.sh
+3
-3
@@ -169,7 +169,7 @@ test_expect_success "$name" '
169
svn up "$SVN_TREE" &&
170
test -f "$SVN_TREE"/exec-2.sh &&
171
test ! -L "$SVN_TREE"/exec-2.sh &&
172
- git diff help "$SVN_TREE"/exec-2.sh'
172
+ test_cmp help "$SVN_TREE"/exec-2.sh'
173
174
if test "$have_utf8" = t
175
then
@@ -193,7 +193,7 @@ test_expect_success "$name" \
193
'git-svn init "$svnrepo" && git-svn fetch &&
194
git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
195
git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
196
- git diff a b'
196
+ test_cmp a b'
197
198
name='check imported tree checksums expected tree checksums'
199
rm -f expected
@@ -211,7 +211,7 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
211
tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4
212
EOF
213
214
-test_expect_success "$name" "git diff a expected"
214
+test_expect_success "$name" "test_cmp a expected"
215
216
test_expect_success 'exit if remote refs are ambigious' "
217
git config --add svn-remote.svn.fetch \
t/t9300-fast-import.sh
+17
-17
@@ -74,7 +74,7 @@ EOF
74
test_expect_success \
75
'A: verify commit' \
76
'git cat-file commit master | sed 1d >actual &&
77
- git diff expect actual'
77
+ test_cmp expect actual'
78
79
cat >expect <<EOF
80
100644 blob file2
@@ -84,22 +84,22 @@ EOF
84
test_expect_success \
85
'A: verify tree' \
86
'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
87
- git diff expect actual'
87
+ test_cmp expect actual'
88
89
echo "$file2_data" >expect
90
test_expect_success \
91
'A: verify file2' \
92
- 'git cat-file blob master:file2 >actual && git diff expect actual'
92
+ 'git cat-file blob master:file2 >actual && test_cmp expect actual'
93
94
echo "$file3_data" >expect
95
test_expect_success \
96
'A: verify file3' \
97
- 'git cat-file blob master:file3 >actual && git diff expect actual'
97
+ 'git cat-file blob master:file3 >actual && test_cmp expect actual'
98
99
printf "$file4_data" >expect
100
test_expect_success \
101
'A: verify file4' \
102
- 'git cat-file blob master:file4 >actual && git diff expect actual'
102
+ 'git cat-file blob master:file4 >actual && test_cmp expect actual'
103
104
cat >expect <<EOF
105
:2 `git rev-parse --verify master:file2`
@@ -109,7 +109,7 @@ cat >expect <<EOF
109
EOF
110
test_expect_success \
111
'A: verify marks output' \
112
- 'git diff expect marks.out'
112
+ 'test_cmp expect marks.out'
113
114
test_expect_success \
115
'A: verify marks import' \
@@ -117,7 +117,7 @@ test_expect_success \
117
--import-marks=marks.out \
118
--export-marks=marks.new \
119
</dev/null &&
120
- git diff -u expect marks.new'
120
+ test_cmp expect marks.new'
121
122
test_tick
123
cat >input <<INPUT_END
@@ -259,7 +259,7 @@ EOF
259
test_expect_success \
260
'C: verify commit' \
261
'git cat-file commit branch | sed 1d >actual &&
262
- git diff expect actual'
262
+ test_cmp expect actual'
263
264
cat >expect <<EOF
265
:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
@@ -316,13 +316,13 @@ echo "$file5_data" >expect
316
test_expect_success \
317
'D: verify file5' \
318
'git cat-file blob branch:newdir/interesting >actual &&
319
- git diff expect actual'
319
+ test_cmp expect actual'
320
321
echo "$file6_data" >expect
322
test_expect_success \
323
'D: verify file6' \
324
'git cat-file blob branch:newdir/exec.sh >actual &&
325
- git diff expect actual'
325
+ test_cmp expect actual'
326
327
###
328
### series E
@@ -358,7 +358,7 @@ EOF
358
test_expect_success \
359
'E: verify commit' \
360
'git cat-file commit branch | sed 1,2d >actual &&
361
- git diff expect actual'
361
+ test_cmp expect actual'
362
363
###
364
### series F
@@ -411,7 +411,7 @@ EOF
411
test_expect_success \
412
'F: verify other commit' \
413
'git cat-file commit other >actual &&
414
- git diff expect actual'
414
+ test_cmp expect actual'
415
416
###
417
### series G
@@ -489,7 +489,7 @@ echo "$file5_data" >expect
489
test_expect_success \
490
'H: verify file' \
491
'git cat-file blob H:h/e/l/lo >actual &&
492
- git diff expect actual'
492
+ test_cmp expect actual'
493
494
###
495
### series I
@@ -515,7 +515,7 @@ EOF
515
test_expect_success \
516
'I: verify edge list' \
517
'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
518
- git diff expect actual'
518
+ test_cmp expect actual'
519
520
###
521
### series J
@@ -625,7 +625,7 @@ test_expect_success \
625
'L: verify internal tree sorting' \
626
'git-fast-import <input &&
627
git diff-tree --abbrev --raw L^ L >output &&
628
- git diff expect output'
628
+ test_cmp expect output'
629
630
###
631
### series M
@@ -885,7 +885,7 @@ test_expect_success \
885
test 8 = `find .git/objects/pack -type f | wc -l` &&
886
test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
887
git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
888
- git diff expect actual'
888
+ test_cmp expect actual'
889
890
cat >input <<INPUT_END
891
commit refs/heads/O4
@@ -916,6 +916,6 @@ test_expect_success \
916
'O: progress outputs as requested by input' \
917
'git-fast-import <input >actual &&
918
grep "progress " <input >expect &&
919
- git diff expect actual'
919
+ test_cmp expect actual'
920
921
test_done
t/t9600-cvsimport.sh
+4
-4
@@ -69,7 +69,7 @@ EOF
69
test_expect_success 'import a trivial module' '
70
71
git cvsimport -a -z 0 -C module-git module &&
72
- git diff module-cvs/o_fortuna module-git/o_fortuna
72
+ test_cmp module-cvs/o_fortuna module-git/o_fortuna
73
74
'
75
@@ -110,7 +110,7 @@ test_expect_success 'update git module' '
110
git cvsimport -a -z 0 module &&
111
git merge origin &&
112
cd .. &&
113
- git diff module-cvs/o_fortuna module-git/o_fortuna
113
+ test_cmp module-cvs/o_fortuna module-git/o_fortuna
114
115
'
116
@@ -131,7 +131,7 @@ test_expect_success 'cvsimport.module config works' '
131
git cvsimport -a -z0 &&
132
git merge origin &&
133
cd .. &&
134
- git diff module-cvs/tick module-git/tick
134
+ test_cmp module-cvs/tick module-git/tick
135
136
'
137
@@ -142,7 +142,7 @@ test_expect_success 'import from a CVS working tree' '
142
git cvsimport -a -z0 &&
143
echo 1 >expect &&
144
git log -1 --pretty=format:%s%n >actual &&
145
- git diff actual expect &&
145
+ test_cmp actual expect &&
146
cd ..
147
148
'