@matheusbsbs / matheus-bagliano / commits / 32a6707267
Fork 0

t4010: abstract away SHA-1-specific constants

Adjust the test so that it computes variables for object IDs 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 Oct 28, 2019 at 00:58 UTC 32a67072673ac444da6c618d62be80559a7728ce
1 file changed +12 -8
t/t4010-diff-pathspec.sh
+12 -8
@@ -17,11 +17,15 @@ test_expect_success \
17 'echo frotz >file0 &&
18 mkdir path1 &&
19 echo rezrov >path1/file1 &&
20 + before0=$(git hash-object file0) &&
21 + before1=$(git hash-object path1/file1) &&
22 git update-index --add file0 path1/file1 &&
23 tree=$(git write-tree) &&
24 echo "$tree" &&
25 echo nitfol >file0 &&
26 echo yomin >path1/file1 &&
27 + after0=$(git hash-object file0) &&
28 + after1=$(git hash-object path1/file1) &&
29 git update-index file0 path1/file1'
30
31 cat >expected <<\EOF
@@ -31,32 +35,32 @@ test_expect_success \
35 'git diff-index --cached $tree -- path >current &&
36 compare_diff_raw current expected'
37
34 -cat >expected <<\EOF
35 -:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1
38 +cat >expected <<EOF
39 +:100644 100644 $before1 $after1 M path1/file1
40 EOF
41 test_expect_success \
42 'limit to path1 should show path1/file1' \
43 'git diff-index --cached $tree -- path1 >current &&
44 compare_diff_raw current expected'
45
42 -cat >expected <<\EOF
43 -:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1
46 +cat >expected <<EOF
47 +:100644 100644 $before1 $after1 M path1/file1
48 EOF
49 test_expect_success \
50 'limit to path1/ should show path1/file1' \
51 'git diff-index --cached $tree -- path1/ >current &&
52 compare_diff_raw current expected'
53
50 -cat >expected <<\EOF
51 -:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1
54 +cat >expected <<EOF
55 +:100644 100644 $before1 $after1 M path1/file1
56 EOF
57 test_expect_success \
58 '"*file1" should show path1/file1' \
59 'git diff-index --cached $tree -- "*file1" >current &&
60 compare_diff_raw current expected'
61
58 -cat >expected <<\EOF
59 -:100644 100644 8e4020bb5a8d8c873b25de15933e75cc0fc275df dca6b92303befc93086aa025d90a5facd7eb2812 M file0
62 +cat >expected <<EOF
63 +:100644 100644 $before0 $after0 M file0
64 EOF
65 test_expect_success \
66 'limit to file0 should show file0' \