@@ -152,26 +152,28 @@ test_expect_success 'prepare' '
152152 EOF
153153'
154154
155+ # --- diff tests ----------------------------------------------------------
156+
155157test_expect_success ' diff: ugly spaces' '
156- git diff old new -- spaces.txt >out &&
158+ git diff --no-indent-heuristic old new -- spaces.txt >out &&
157159 compare_diff spaces-expect out
158160'
159161
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+
160167test_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 &&
162169 compare_diff spaces-compacted-expect out-compacted
163170'
164171
165- test_expect_success ' diff: nice spaces with diff.indentHeuristic' '
172+ test_expect_success ' diff: nice spaces with diff.indentHeuristic=true ' '
166173 git -c diff.indentHeuristic=true diff old new -- spaces.txt >out-compacted2 &&
167174 compare_diff spaces-compacted-expect out-compacted2
168175'
169176
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-
175177test_expect_success ' diff: --indent-heuristic with --patience' '
176178 git diff --indent-heuristic --patience old new -- spaces.txt >out-compacted3 &&
177179 compare_diff spaces-compacted-expect out-compacted3
@@ -183,7 +185,7 @@ test_expect_success 'diff: --indent-heuristic with --histogram' '
183185'
184186
185187test_expect_success ' diff: ugly functions' '
186- git diff old new -- functions.c >out &&
188+ git diff --no-indent-heuristic old new -- functions.c >out &&
187189 compare_diff functions-expect out
188190'
189191
@@ -192,25 +194,175 @@ test_expect_success 'diff: nice functions with --indent-heuristic' '
192194 compare_diff functions-compacted-expect out-compacted
193195'
194196
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 ---------------------------------------------------------
199198
200199test_expect_success ' blame: nice spaces with --indent-heuristic' '
201200 git blame --indent-heuristic old..new -- spaces.txt >out-blame-compacted &&
202201 compare_blame spaces-compacted-expect out-blame-compacted
203202'
204203
205- test_expect_success ' blame: nice spaces with diff.indentHeuristic' '
204+ test_expect_success ' blame: nice spaces with diff.indentHeuristic=true ' '
206205 git -c diff.indentHeuristic=true blame old..new -- spaces.txt >out-blame-compacted2 &&
207206 compare_blame spaces-compacted-expect out-blame-compacted2
208207'
209208
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+
210219test_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 &&
212221 git blame old..new -- spaces.txt >out-blame &&
213- compare_blame spaces-expect out-blame2
222+ compare_blame spaces-expect out-blame3
223+ '
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+
232+ test_expect_success ' diff-tree: nice spaces with --indent-heuristic' '
233+ git diff-tree --indent-heuristic -p old new -- spaces.txt >out-diff-tree-compacted &&
234+ compare_diff spaces-compacted-expect out-diff-tree-compacted
235+ '
236+
237+ test_expect_success ' diff-tree: nice spaces with diff.indentHeuristic=true' '
238+ git -c diff.indentHeuristic=true diff-tree -p old new -- spaces.txt >out-diff-tree-compacted2 &&
239+ compare_diff spaces-compacted-expect out-diff-tree-compacted2
240+ '
241+
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 &&
244+ compare_diff spaces-expect out-diff-tree
245+ '
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+
264+ test_expect_success ' diff-index: nice spaces with --indent-heuristic' '
265+ git checkout -B diff-index &&
266+ git reset --soft HEAD~ &&
267+ git diff-index --indent-heuristic -p old -- spaces.txt >out-diff-index-compacted &&
268+ compare_diff spaces-compacted-expect out-diff-index-compacted &&
269+ git checkout -f master
270+ '
271+
272+ test_expect_success ' diff-index: nice spaces with diff.indentHeuristic=true' '
273+ git checkout -B diff-index &&
274+ git reset --soft HEAD~ &&
275+ git -c diff.indentHeuristic=true diff-index -p old -- spaces.txt >out-diff-index-compacted2 &&
276+ compare_diff spaces-compacted-expect out-diff-index-compacted2 &&
277+ git checkout -f master
278+ '
279+
280+ test_expect_success ' diff-index: ugly spaces with --no-indent-heuristic' '
281+ git checkout -B diff-index &&
282+ git reset --soft HEAD~ &&
283+ git diff-index --no-indent-heuristic -p old -- spaces.txt >out-diff-index &&
284+ compare_diff spaces-expect out-diff-index &&
285+ git checkout -f master
286+ '
287+
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' '
315+ git checkout -B diff-files &&
316+ git reset HEAD~ &&
317+ git diff-files --indent-heuristic -p spaces.txt >out-diff-files-raw &&
318+ grep -v index out-diff-files-raw >out-diff-files-compacted &&
319+ compare_diff spaces-compacted-expect out-diff-files-compacted &&
320+ git checkout -f master
321+ '
322+
323+ test_expect_success ' diff-files: nice spaces with diff.indentHeuristic=true' '
324+ git checkout -B diff-files &&
325+ git reset HEAD~ &&
326+ git -c diff.indentHeuristic=true diff-files -p spaces.txt >out-diff-files-raw2 &&
327+ grep -v index out-diff-files-raw2 >out-diff-files-compacted2 &&
328+ compare_diff spaces-compacted-expect out-diff-files-compacted2 &&
329+ git checkout -f master
330+ '
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+
359+ test_expect_success ' diff-files: --no-indent-heuristic overrides config' '
360+ git checkout -B diff-files &&
361+ git reset HEAD~ &&
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 &&
364+ compare_diff spaces-expect out-diff-files &&
365+ git checkout -f master
214366'
215367
216368test_done
0 commit comments