@@ -152,26 +152,28 @@ test_expect_success 'prepare' '
152
152
EOF
153
153
'
154
154
155
+ # --- diff tests ----------------------------------------------------------
156
+
155
157
test_expect_success ' diff: ugly spaces' '
156
- git diff old new -- spaces.txt >out &&
158
+ git diff --no-indent-heuristic old new -- spaces.txt >out &&
157
159
compare_diff spaces-expect out
158
160
'
159
161
162
+ test_expect_success ' diff: --no-indent-heuristic overrides config' '
163
+ git -c diff.indentHeuristic=true diff --no-indent-heuristic old new -- spaces.txt >out2 &&
164
+ compare_diff spaces-expect out2
165
+ '
166
+
160
167
test_expect_success ' diff: nice spaces with --indent-heuristic' '
161
- git diff --indent-heuristic old new -- spaces.txt >out-compacted &&
168
+ git -c diff.indentHeuristic=false diff --indent-heuristic old new -- spaces.txt >out-compacted &&
162
169
compare_diff spaces-compacted-expect out-compacted
163
170
'
164
171
165
- test_expect_success ' diff: nice spaces with diff.indentHeuristic' '
172
+ test_expect_success ' diff: nice spaces with diff.indentHeuristic=true ' '
166
173
git -c diff.indentHeuristic=true diff old new -- spaces.txt >out-compacted2 &&
167
174
compare_diff spaces-compacted-expect out-compacted2
168
175
'
169
176
170
- test_expect_success ' diff: --no-indent-heuristic overrides config' '
171
- git -c diff.indentHeuristic=true diff --no-indent-heuristic old new -- spaces.txt >out2 &&
172
- compare_diff spaces-expect out2
173
- '
174
-
175
177
test_expect_success ' diff: --indent-heuristic with --patience' '
176
178
git diff --indent-heuristic --patience old new -- spaces.txt >out-compacted3 &&
177
179
compare_diff spaces-compacted-expect out-compacted3
@@ -183,7 +185,7 @@ test_expect_success 'diff: --indent-heuristic with --histogram' '
183
185
'
184
186
185
187
test_expect_success ' diff: ugly functions' '
186
- git diff old new -- functions.c >out &&
188
+ git diff --no-indent-heuristic old new -- functions.c >out &&
187
189
compare_diff functions-expect out
188
190
'
189
191
@@ -192,42 +194,73 @@ test_expect_success 'diff: nice functions with --indent-heuristic' '
192
194
compare_diff functions-compacted-expect out-compacted
193
195
'
194
196
195
- test_expect_success ' blame: ugly spaces' '
196
- git blame old..new -- spaces.txt >out-blame &&
197
- compare_blame spaces-expect out-blame
198
- '
197
+ # --- blame tests ---------------------------------------------------------
199
198
200
199
test_expect_success ' blame: nice spaces with --indent-heuristic' '
201
200
git blame --indent-heuristic old..new -- spaces.txt >out-blame-compacted &&
202
201
compare_blame spaces-compacted-expect out-blame-compacted
203
202
'
204
203
205
- test_expect_success ' blame: nice spaces with diff.indentHeuristic' '
204
+ test_expect_success ' blame: nice spaces with diff.indentHeuristic=true ' '
206
205
git -c diff.indentHeuristic=true blame old..new -- spaces.txt >out-blame-compacted2 &&
207
206
compare_blame spaces-compacted-expect out-blame-compacted2
208
207
'
209
208
209
+ test_expect_success ' blame: ugly spaces with --no-indent-heuristic' '
210
+ git blame --no-indent-heuristic old..new -- spaces.txt >out-blame &&
211
+ compare_blame spaces-expect out-blame
212
+ '
213
+
214
+ test_expect_success ' blame: ugly spaces with diff.indentHeuristic=false' '
215
+ git -c diff.indentHeuristic=false blame old..new -- spaces.txt >out-blame2 &&
216
+ compare_blame spaces-expect out-blame2
217
+ '
218
+
210
219
test_expect_success ' blame: --no-indent-heuristic overrides config' '
211
- git -c diff.indentHeuristic=true blame --no-indent-heuristic old..new -- spaces.txt >out-blame2 &&
220
+ git -c diff.indentHeuristic=true blame --no-indent-heuristic old..new -- spaces.txt >out-blame3 &&
212
221
git blame old..new -- spaces.txt >out-blame &&
213
- compare_blame spaces-expect out-blame2
222
+ compare_blame spaces-expect out-blame3
214
223
'
215
224
225
+ test_expect_success ' blame: --indent-heuristic overrides config' '
226
+ git -c diff.indentHeuristic=false blame --indent-heuristic old..new -- spaces.txt >out-blame-compacted3 &&
227
+ compare_blame spaces-compacted-expect out-blame-compacted2
228
+ '
229
+
230
+ # --- diff-tree tests -----------------------------------------------------
231
+
216
232
test_expect_success ' diff-tree: nice spaces with --indent-heuristic' '
217
233
git diff-tree --indent-heuristic -p old new -- spaces.txt >out-diff-tree-compacted &&
218
234
compare_diff spaces-compacted-expect out-diff-tree-compacted
219
235
'
220
236
221
- test_expect_success ' diff-tree: nice spaces with diff.indentHeuristic' '
237
+ test_expect_success ' diff-tree: nice spaces with diff.indentHeuristic=true ' '
222
238
git -c diff.indentHeuristic=true diff-tree -p old new -- spaces.txt >out-diff-tree-compacted2 &&
223
239
compare_diff spaces-compacted-expect out-diff-tree-compacted2
224
240
'
225
241
226
- test_expect_success ' diff-tree: --no-indent-heuristic overrides config ' '
227
- git -c diff.indentHeuristic=true diff-tree --no-indent-heuristic -p old new -- spaces.txt >out-diff-tree &&
242
+ test_expect_success ' diff-tree: ugly spaces with --no-indent-heuristic' '
243
+ git diff-tree --no-indent-heuristic -p old new -- spaces.txt >out-diff-tree &&
228
244
compare_diff spaces-expect out-diff-tree
229
245
'
230
246
247
+ test_expect_success ' diff-tree: ugly spaces with diff.indentHeuristic=false' '
248
+ git -c diff.indentHeuristic=false diff-tree -p old new -- spaces.txt >out-diff-tree2 &&
249
+ compare_diff spaces-expect out-diff-tree2
250
+ '
251
+
252
+ test_expect_success ' diff-tree: --indent-heuristic overrides config' '
253
+ git -c diff.indentHeuristic=false diff-tree --indent-heuristic -p old new -- spaces.txt >out-diff-tree-compacted3 &&
254
+ compare_diff spaces-compacted-expect out-diff-tree-compacted3
255
+ '
256
+
257
+ test_expect_success ' diff-tree: --no-indent-heuristic overrides config' '
258
+ git -c diff.indentHeuristic=true diff-tree --no-indent-heuristic -p old new -- spaces.txt >out-diff-tree3 &&
259
+ compare_diff spaces-expect out-diff-tree3
260
+ '
261
+
262
+ # --- diff-index tests ----------------------------------------------------
263
+
231
264
test_expect_success ' diff-index: nice spaces with --indent-heuristic' '
232
265
git checkout -B diff-index &&
233
266
git reset --soft HEAD~ &&
@@ -236,32 +269,58 @@ test_expect_success 'diff-index: nice spaces with --indent-heuristic' '
236
269
git checkout -f master
237
270
'
238
271
239
- test_expect_success ' diff-index: nice spaces with diff.indentHeuristic' '
272
+ test_expect_success ' diff-index: nice spaces with diff.indentHeuristic=true ' '
240
273
git checkout -B diff-index &&
241
274
git reset --soft HEAD~ &&
242
275
git -c diff.indentHeuristic=true diff-index -p old -- spaces.txt >out-diff-index-compacted2 &&
243
276
compare_diff spaces-compacted-expect out-diff-index-compacted2 &&
244
277
git checkout -f master
245
278
'
246
279
247
- test_expect_success ' diff-index: --no-indent-heuristic overrides config ' '
280
+ test_expect_success ' diff-index: ugly spaces with --no-indent-heuristic' '
248
281
git checkout -B diff-index &&
249
282
git reset --soft HEAD~ &&
250
- git -c diff.indentHeuristic=true diff-index --no-indent-heuristic -p old -- spaces.txt >out-diff-index &&
283
+ git diff-index --no-indent-heuristic -p old -- spaces.txt >out-diff-index &&
251
284
compare_diff spaces-expect out-diff-index &&
252
285
git checkout -f master
253
286
'
254
287
255
- test_expect_success ' diff-files: nice spaces with diff.indentHeuristic' '
288
+ test_expect_success ' diff-index: ugly spaces with diff.indentHeuristic=false' '
289
+ git checkout -B diff-index &&
290
+ git reset --soft HEAD~ &&
291
+ git -c diff.indentHeuristic=false diff-index -p old -- spaces.txt >out-diff-index2 &&
292
+ compare_diff spaces-expect out-diff-index2 &&
293
+ git checkout -f master
294
+ '
295
+
296
+ test_expect_success ' diff-index: --indent-heuristic overrides config' '
297
+ git checkout -B diff-index &&
298
+ git reset --soft HEAD~ &&
299
+ git -c diff.indentHeuristic=false diff-index --indent-heuristic -p old -- spaces.txt >out-diff-index-compacted3 &&
300
+ compare_diff spaces-compacted-expect out-diff-index-compacted3 &&
301
+ git checkout -f master
302
+ '
303
+
304
+ test_expect_success ' diff-index: --no-indent-heuristic overrides config' '
305
+ git checkout -B diff-index &&
306
+ git reset --soft HEAD~ &&
307
+ git -c diff.indentHeuristic=true diff-index --no-indent-heuristic -p old -- spaces.txt >out-diff-index3 &&
308
+ compare_diff spaces-expect out-diff-index3 &&
309
+ git checkout -f master
310
+ '
311
+
312
+ # --- diff-files tests ----------------------------------------------------
313
+
314
+ test_expect_success ' diff-files: nice spaces with --indent-heuristic' '
256
315
git checkout -B diff-files &&
257
316
git reset HEAD~ &&
258
- git -c diff.indentHeuristic=true diff -files -p spaces.txt >out-diff-files-raw &&
317
+ git diff-files --indent-heuristic -p spaces.txt >out-diff-files-raw &&
259
318
grep -v index out-diff-files-raw >out-diff-files-compacted &&
260
319
compare_diff spaces-compacted-expect out-diff-files-compacted &&
261
320
git checkout -f master
262
321
'
263
322
264
- test_expect_success ' diff-files: nice spaces with diff.indentHeuristic' '
323
+ test_expect_success ' diff-files: nice spaces with diff.indentHeuristic=true ' '
265
324
git checkout -B diff-files &&
266
325
git reset HEAD~ &&
267
326
git -c diff.indentHeuristic=true diff-files -p spaces.txt >out-diff-files-raw2 &&
@@ -270,11 +329,38 @@ test_expect_success 'diff-files: nice spaces with diff.indentHeuristic' '
270
329
git checkout -f master
271
330
'
272
331
332
+ test_expect_success ' diff-files: ugly spaces with --no-indent-heuristic' '
333
+ git checkout -B diff-files &&
334
+ git reset HEAD~ &&
335
+ git diff-files --no-indent-heuristic -p spaces.txt >out-diff-files-raw &&
336
+ grep -v index out-diff-files-raw >out-diff-files &&
337
+ compare_diff spaces-expect out-diff-files &&
338
+ git checkout -f master
339
+ '
340
+
341
+ test_expect_success ' diff-files: ugly spaces with diff.indentHeuristic=false' '
342
+ git checkout -B diff-files &&
343
+ git reset HEAD~ &&
344
+ git -c diff.indentHeuristic=false diff-files -p spaces.txt >out-diff-files-raw2 &&
345
+ grep -v index out-diff-files-raw2 >out-diff-files &&
346
+ compare_diff spaces-expect out-diff-files &&
347
+ git checkout -f master
348
+ '
349
+
350
+ test_expect_success ' diff-files: --indent-heuristic overrides config' '
351
+ git checkout -B diff-files &&
352
+ git reset HEAD~ &&
353
+ git -c diff.indentHeuristic=false diff-files --indent-heuristic -p spaces.txt >out-diff-files-raw3 &&
354
+ grep -v index out-diff-files-raw3 >out-diff-files-compacted &&
355
+ compare_diff spaces-compacted-expect out-diff-files-compacted &&
356
+ git checkout -f master
357
+ '
358
+
273
359
test_expect_success ' diff-files: --no-indent-heuristic overrides config' '
274
360
git checkout -B diff-files &&
275
361
git reset HEAD~ &&
276
- git -c diff.indentHeuristic=true diff-files --no-indent-heuristic -p spaces.txt >out-diff-files-raw3 &&
277
- grep -v index out-diff-files-raw3 >out-diff-files &&
362
+ git -c diff.indentHeuristic=true diff-files --no-indent-heuristic -p spaces.txt >out-diff-files-raw4 &&
363
+ grep -v index out-diff-files-raw4 >out-diff-files &&
278
364
compare_diff spaces-expect out-diff-files &&
279
365
git checkout -f master
280
366
'
0 commit comments