t4022: abstract away SHA-1-specific constants

Adjust the test so that it computes variables for blobs instead of using hard-coded hashes. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed May 21, 2018 at 02:01 UTC 10c636a79a3786a5089b345032afe4bc23865a97
1 file changed +4 -2
t/t4022-diff-rewrite.sh
+4 -2
@@ -13,6 +13,8 @@ test_expect_success setup '
13 "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \
14 <"$TEST_DIRECTORY"/../COPYING >test &&
15 echo "to be deleted" >test2 &&
16 + blob=$(git hash-object test2) &&
17 + blob=$(git rev-parse --short $blob) &&
18 git add test2
19
20 '
@@ -27,7 +29,7 @@ test_expect_success 'detect rewrite' '
29 cat >expect <<EOF
30 diff --git a/test2 b/test2
31 deleted file mode 100644
30 -index 4202011..0000000
32 +index $blob..0000000
33 --- a/test2
34 +++ /dev/null
35 @@ -1 +0,0 @@
@@ -43,7 +45,7 @@ test_expect_success 'show deletion diff without -D' '
45 cat >expect <<EOF
46 diff --git a/test2 b/test2
47 deleted file mode 100644
46 -index 4202011..0000000
48 +index $blob..0000000
49 EOF
50 test_expect_success 'suppress deletion diff with -D' '
51