@matheusbsbs / matheus-bagliano / commits / 0370b35414
Fork 0

t4038: abstract away SHA-1 specific constants

Compute several object IDs that exist in expected output, since we don't care about the specific object IDs, only that the format of the output is syntactically correct. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Oct 28, 2019 at 00:59 UTC 0370b354147de8cb25cf9722bf70a441c0d1fbf4
1 file changed +13 -6
t/t4038-diff-combined.sh
+13 -6
@@ -440,11 +440,13 @@ test_expect_success 'setup for --combined-all-paths' '
440 git branch side2c &&
441 git checkout side1c &&
442 test_seq 1 10 >filename-side1c &&
443 + side1cf=$(git hash-object filename-side1c) &&
444 git add filename-side1c &&
445 git commit -m with &&
446 git checkout side2c &&
447 test_seq 1 9 >filename-side2c &&
448 echo ten >>filename-side2c &&
449 + side2cf=$(git hash-object filename-side2c) &&
450 git add filename-side2c &&
451 git commit -m iam &&
452 git checkout -b mergery side1c &&
@@ -452,13 +454,14 @@ test_expect_success 'setup for --combined-all-paths' '
454 git rm filename-side1c &&
455 echo eleven >>filename-side2c &&
456 git mv filename-side2c filename-merged &&
457 + mergedf=$(git hash-object filename-merged) &&
458 git add filename-merged &&
459 git commit
460 '
461
462 test_expect_success '--combined-all-paths and --raw' '
460 - cat <<-\EOF >expect &&
461 - ::100644 100644 100644 f00c965d8307308469e537302baa73048488f162 088bd5d92c2a8e0203ca8e7e4c2a5c692f6ae3f7 333b9c62519f285e1854830ade0fe1ef1d40ee1b RR filename-side1c filename-side2c filename-merged
463 + cat <<-EOF >expect &&
464 + ::100644 100644 100644 $side1cf $side2cf $mergedf RR filename-side1c filename-side2c filename-merged
465 EOF
466 git diff-tree -c -M --raw --combined-all-paths HEAD >actual.tmp &&
467 sed 1d <actual.tmp >actual &&
@@ -482,11 +485,13 @@ test_expect_success FUNNYNAMES 'setup for --combined-all-paths with funny names'
485 git checkout side1d &&
486 test_seq 1 10 >"$(printf "file\twith\ttabs")" &&
487 git add file* &&
488 + side1df=$(git hash-object *tabs) &&
489 git commit -m with &&
490 git checkout side2d &&
491 test_seq 1 9 >"$(printf "i\tam\ttabbed")" &&
492 echo ten >>"$(printf "i\tam\ttabbed")" &&
493 git add *tabbed &&
494 + side2df=$(git hash-object *tabbed) &&
495 git commit -m iam &&
496 git checkout -b funny-names-mergery side1d &&
497 git merge --no-commit side2d &&
@@ -494,12 +499,14 @@ test_expect_success FUNNYNAMES 'setup for --combined-all-paths with funny names'
499 echo eleven >>"$(printf "i\tam\ttabbed")" &&
500 git mv "$(printf "i\tam\ttabbed")" "$(printf "fickle\tnaming")" &&
501 git add fickle* &&
497 - git commit
502 + headf=$(git hash-object fickle*) &&
503 + git commit &&
504 + head=$(git rev-parse HEAD)
505 '
506
507 test_expect_success FUNNYNAMES '--combined-all-paths and --raw and funny names' '
501 - cat <<-\EOF >expect &&
502 - ::100644 100644 100644 f00c965d8307308469e537302baa73048488f162 088bd5d92c2a8e0203ca8e7e4c2a5c692f6ae3f7 333b9c62519f285e1854830ade0fe1ef1d40ee1b RR "file\twith\ttabs" "i\tam\ttabbed" "fickle\tnaming"
508 + cat <<-EOF >expect &&
509 + ::100644 100644 100644 $side1df $side2df $headf RR "file\twith\ttabs" "i\tam\ttabbed" "fickle\tnaming"
510 EOF
511 git diff-tree -c -M --raw --combined-all-paths HEAD >actual.tmp &&
512 sed 1d <actual.tmp >actual &&
@@ -507,7 +514,7 @@ test_expect_success FUNNYNAMES '--combined-all-paths and --raw and funny names'
514 '
515
516 test_expect_success FUNNYNAMES '--combined-all-paths and --raw -and -z and funny names' '
510 - printf "aaf8087c3cbd4db8e185a2d074cf27c53cfb75d7\0::100644 100644 100644 f00c965d8307308469e537302baa73048488f162 088bd5d92c2a8e0203ca8e7e4c2a5c692f6ae3f7 333b9c62519f285e1854830ade0fe1ef1d40ee1b RR\0file\twith\ttabs\0i\tam\ttabbed\0fickle\tnaming\0" >expect &&
517 + printf "$head\0::100644 100644 100644 $side1df $side2df $headf RR\0file\twith\ttabs\0i\tam\ttabbed\0fickle\tnaming\0" >expect &&
518 git diff-tree -c -M --raw --combined-all-paths -z HEAD >actual &&
519 test_cmp -a expect actual
520 '