t4002-diff-basic: modernize test format

Some tests still use the old format with four spaces indentation. Standardize the tests to the new format with tab indentation. Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Cai committed May 18, 2023 at 20:03 UTC 9cfcbcc095fbe6bc4a1f366281bd80e53d5bb473
1 file changed +121 -122
t/t4002-diff-basic.sh
+121 -122
@@ -284,132 +284,131 @@ cmp_diff_files_output () {
284 test_cmp "$1" .test-tmp
285 }
286
287 -test_expect_success \
288 - 'diff-tree of known trees.' \
289 - 'git diff-tree $tree_O $tree_A >.test-a &&
290 - cmp -s .test-a .test-plain-OA'
291 -
292 -test_expect_success \
293 - 'diff-tree of known trees.' \
294 - 'git diff-tree -r $tree_O $tree_A >.test-a &&
295 - cmp -s .test-a .test-recursive-OA'
296 -
297 -test_expect_success \
298 - 'diff-tree of known trees.' \
299 - 'git diff-tree $tree_O $tree_B >.test-a &&
300 - cmp -s .test-a .test-plain-OB'
301 -
302 -test_expect_success \
303 - 'diff-tree of known trees.' \
304 - 'git diff-tree -r $tree_O $tree_B >.test-a &&
305 - cmp -s .test-a .test-recursive-OB'
306 -
307 -test_expect_success \
308 - 'diff-tree of known trees.' \
309 - 'git diff-tree $tree_A $tree_B >.test-a &&
310 - cmp -s .test-a .test-plain-AB'
311 -
312 -test_expect_success \
313 - 'diff-tree of known trees.' \
314 - 'git diff-tree -r $tree_A $tree_B >.test-a &&
315 - cmp -s .test-a .test-recursive-AB'
316 -
317 -test_expect_success \
318 - 'diff-tree --stdin of known trees.' \
319 - 'echo $tree_A $tree_B | git diff-tree --stdin > .test-a &&
320 - echo $tree_A $tree_B > .test-plain-ABx &&
321 - cat .test-plain-AB >> .test-plain-ABx &&
322 - cmp -s .test-a .test-plain-ABx'
323 -
324 -test_expect_success \
325 - 'diff-tree --stdin of known trees.' \
326 - 'echo $tree_A $tree_B | git diff-tree -r --stdin > .test-a &&
327 - echo $tree_A $tree_B > .test-recursive-ABx &&
328 - cat .test-recursive-AB >> .test-recursive-ABx &&
329 - cmp -s .test-a .test-recursive-ABx'
330 -
331 -test_expect_success \
332 - 'diff-cache O with A in cache' \
333 - 'git read-tree $tree_A &&
334 - git diff-index --cached $tree_O >.test-a &&
335 - cmp -s .test-a .test-recursive-OA'
336 -
337 -test_expect_success \
338 - 'diff-cache O with B in cache' \
339 - 'git read-tree $tree_B &&
340 - git diff-index --cached $tree_O >.test-a &&
341 - cmp -s .test-a .test-recursive-OB'
342 -
343 -test_expect_success \
344 - 'diff-cache A with B in cache' \
345 - 'git read-tree $tree_B &&
346 - git diff-index --cached $tree_A >.test-a &&
347 - cmp -s .test-a .test-recursive-AB'
348 -
349 -test_expect_success \
350 - 'diff-files with O in cache and A checked out' \
351 - 'rm -fr Z [A-Z][A-Z] &&
352 - git read-tree $tree_A &&
353 - git checkout-index -f -a &&
354 - git read-tree --reset $tree_O &&
355 - test_must_fail git update-index --refresh -q &&
356 - git diff-files >.test-a &&
357 - cmp_diff_files_output .test-a .test-recursive-OA'
358 -
359 -test_expect_success \
360 - 'diff-files with O in cache and B checked out' \
361 - 'rm -fr Z [A-Z][A-Z] &&
362 - git read-tree $tree_B &&
363 - git checkout-index -f -a &&
364 - git read-tree --reset $tree_O &&
365 - test_must_fail git update-index --refresh -q &&
366 - git diff-files >.test-a &&
367 - cmp_diff_files_output .test-a .test-recursive-OB'
368 -
369 -test_expect_success \
370 - 'diff-files with A in cache and B checked out' \
371 - 'rm -fr Z [A-Z][A-Z] &&
372 - git read-tree $tree_B &&
373 - git checkout-index -f -a &&
374 - git read-tree --reset $tree_A &&
375 - test_must_fail git update-index --refresh -q &&
376 - git diff-files >.test-a &&
377 - cmp_diff_files_output .test-a .test-recursive-AB'
287 +test_expect_success 'diff-tree of known trees.' '
288 + git diff-tree $tree_O $tree_A >.test-a &&
289 + cmp -s .test-a .test-plain-OA
290 +'
291 +
292 +test_expect_success 'diff-tree of known trees.' '
293 + git diff-tree -r $tree_O $tree_A >.test-a &&
294 + cmp -s .test-a .test-recursive-OA
295 +'
296 +
297 +test_expect_success 'diff-tree of known trees.' '
298 + git diff-tree $tree_O $tree_B >.test-a &&
299 + cmp -s .test-a .test-plain-OB
300 +'
301 +
302 +test_expect_success 'diff-tree of known trees.' '
303 + git diff-tree -r $tree_O $tree_B >.test-a &&
304 + cmp -s .test-a .test-recursive-OB
305 +'
306 +
307 +test_expect_success 'diff-tree of known trees.' '
308 + git diff-tree $tree_A $tree_B >.test-a &&
309 + cmp -s .test-a .test-plain-AB
310 +'
311 +
312 +test_expect_success 'diff-tree of known trees.' '
313 + git diff-tree -r $tree_A $tree_B >.test-a &&
314 + cmp -s .test-a .test-recursive-AB
315 +'
316 +
317 +test_expect_success 'diff-tree --stdin of known trees.' '
318 + echo $tree_A $tree_B | git diff-tree --stdin > .test-a &&
319 + echo $tree_A $tree_B > .test-plain-ABx &&
320 + cat .test-plain-AB >> .test-plain-ABx &&
321 + cmp -s .test-a .test-plain-ABx
322 +'
323 +
324 +test_expect_success 'diff-tree --stdin of known trees.' '
325 + echo $tree_A $tree_B | git diff-tree -r --stdin > .test-a &&
326 + echo $tree_A $tree_B > .test-recursive-ABx &&
327 + cat .test-recursive-AB >> .test-recursive-ABx &&
328 + cmp -s .test-a .test-recursive-ABx
329 +'
330 +
331 +test_expect_success 'diff-cache O with A in cache' '
332 + git read-tree $tree_A &&
333 + git diff-index --cached $tree_O >.test-a &&
334 + cmp -s .test-a .test-recursive-OA
335 +'
336 +
337 +test_expect_success 'diff-cache O with B in cache' '
338 + git read-tree $tree_B &&
339 + git diff-index --cached $tree_O >.test-a &&
340 + cmp -s .test-a .test-recursive-OB
341 +'
342 +
343 +test_expect_success 'diff-cache A with B in cache' '
344 + git read-tree $tree_B &&
345 + git diff-index --cached $tree_A >.test-a &&
346 + cmp -s .test-a .test-recursive-AB
347 +'
348 +
349 +test_expect_success 'diff-files with O in cache and A checked out' '
350 + rm -fr Z [A-Z][A-Z] &&
351 + git read-tree $tree_A &&
352 + git checkout-index -f -a &&
353 + git read-tree --reset $tree_O &&
354 + test_must_fail git update-index --refresh -q &&
355 + git diff-files >.test-a &&
356 + cmp_diff_files_output .test-a .test-recursive-OA
357 +'
358 +
359 +test_expect_success 'diff-files with O in cache and B checked out' '
360 + rm -fr Z [A-Z][A-Z] &&
361 + git read-tree $tree_B &&
362 + git checkout-index -f -a &&
363 + git read-tree --reset $tree_O &&
364 + test_must_fail git update-index --refresh -q &&
365 + git diff-files >.test-a &&
366 + cmp_diff_files_output .test-a .test-recursive-OB
367 +'
368 +
369 +test_expect_success 'diff-files with A in cache and B checked out' '
370 + rm -fr Z [A-Z][A-Z] &&
371 + git read-tree $tree_B &&
372 + git checkout-index -f -a &&
373 + git read-tree --reset $tree_A &&
374 + test_must_fail git update-index --refresh -q &&
375 + git diff-files >.test-a &&
376 + cmp_diff_files_output .test-a .test-recursive-AB
377 +'
378
379 ################################################################
380 # Now we have established the baseline, we do not have to
381 # rely on individual object ID values that much.
382
383 -test_expect_success \
384 - 'diff-tree O A == diff-tree -R A O' \
385 - 'git diff-tree $tree_O $tree_A >.test-a &&
386 - git diff-tree -R $tree_A $tree_O >.test-b &&
387 - cmp -s .test-a .test-b'
388 -
389 -test_expect_success \
390 - 'diff-tree -r O A == diff-tree -r -R A O' \
391 - 'git diff-tree -r $tree_O $tree_A >.test-a &&
392 - git diff-tree -r -R $tree_A $tree_O >.test-b &&
393 - cmp -s .test-a .test-b'
394 -
395 -test_expect_success \
396 - 'diff-tree B A == diff-tree -R A B' \
397 - 'git diff-tree $tree_B $tree_A >.test-a &&
398 - git diff-tree -R $tree_A $tree_B >.test-b &&
399 - cmp -s .test-a .test-b'
400 -
401 -test_expect_success \
402 - 'diff-tree -r B A == diff-tree -r -R A B' \
403 - 'git diff-tree -r $tree_B $tree_A >.test-a &&
404 - git diff-tree -r -R $tree_A $tree_B >.test-b &&
405 - cmp -s .test-a .test-b'
406 -
407 -test_expect_success \
408 - 'diff can read from stdin' \
409 - 'test_must_fail git diff --no-index -- MN - < NN |
410 - grep -v "^index" | sed "s#/-#/NN#" >.test-a &&
411 - test_must_fail git diff --no-index -- MN NN |
412 - grep -v "^index" >.test-b &&
413 - test_cmp .test-a .test-b'
383 +test_expect_success 'diff-tree O A == diff-tree -R A O' '
384 + git diff-tree $tree_O $tree_A >.test-a &&
385 + git diff-tree -R $tree_A $tree_O >.test-b &&
386 + cmp -s .test-a .test-b
387 +'
388 +
389 +test_expect_success 'diff-tree -r O A == diff-tree -r -R A O' '
390 + git diff-tree -r $tree_O $tree_A >.test-a &&
391 + git diff-tree -r -R $tree_A $tree_O >.test-b &&
392 + cmp -s .test-a .test-b
393 +'
394 +
395 +test_expect_success 'diff-tree B A == diff-tree -R A B' '
396 + git diff-tree $tree_B $tree_A >.test-a &&
397 + git diff-tree -R $tree_A $tree_B >.test-b &&
398 + cmp -s .test-a .test-b
399 +'
400 +
401 +test_expect_success 'diff-tree -r B A == diff-tree -r -R A B' '
402 + git diff-tree -r $tree_B $tree_A >.test-a &&
403 + git diff-tree -r -R $tree_A $tree_B >.test-b &&
404 + cmp -s .test-a .test-b'
405 +
406 +test_expect_success'diff can read from stdin' '
407 + test_must_fail git diff --no-index -- MN - < NN |
408 + grep -v "^index" | sed "s#/-#/NN#" >.test-a &&
409 + test_must_fail git diff --no-index -- MN NN |
410 + grep -v "^index" >.test-b &&
411 + test_cmp .test-a .test-b
412 +'
413
414 test_done