Skip to content

Commit 32a6707

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 440bf91 commit 32a6707

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

t/t4010-diff-pathspec.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ test_expect_success \
1717
'echo frotz >file0 &&
1818
mkdir path1 &&
1919
echo rezrov >path1/file1 &&
20+
before0=$(git hash-object file0) &&
21+
before1=$(git hash-object path1/file1) &&
2022
git update-index --add file0 path1/file1 &&
2123
tree=$(git write-tree) &&
2224
echo "$tree" &&
2325
echo nitfol >file0 &&
2426
echo yomin >path1/file1 &&
27+
after0=$(git hash-object file0) &&
28+
after1=$(git hash-object path1/file1) &&
2529
git update-index file0 path1/file1'
2630

2731
cat >expected <<\EOF
@@ -31,32 +35,32 @@ test_expect_success \
3135
'git diff-index --cached $tree -- path >current &&
3236
compare_diff_raw current expected'
3337

34-
cat >expected <<\EOF
35-
:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1
38+
cat >expected <<EOF
39+
:100644 100644 $before1 $after1 M path1/file1
3640
EOF
3741
test_expect_success \
3842
'limit to path1 should show path1/file1' \
3943
'git diff-index --cached $tree -- path1 >current &&
4044
compare_diff_raw current expected'
4145

42-
cat >expected <<\EOF
43-
:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1
46+
cat >expected <<EOF
47+
:100644 100644 $before1 $after1 M path1/file1
4448
EOF
4549
test_expect_success \
4650
'limit to path1/ should show path1/file1' \
4751
'git diff-index --cached $tree -- path1/ >current &&
4852
compare_diff_raw current expected'
4953

50-
cat >expected <<\EOF
51-
:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1
54+
cat >expected <<EOF
55+
:100644 100644 $before1 $after1 M path1/file1
5256
EOF
5357
test_expect_success \
5458
'"*file1" should show path1/file1' \
5559
'git diff-index --cached $tree -- "*file1" >current &&
5660
compare_diff_raw current expected'
5761

58-
cat >expected <<\EOF
59-
:100644 100644 8e4020bb5a8d8c873b25de15933e75cc0fc275df dca6b92303befc93086aa025d90a5facd7eb2812 M file0
62+
cat >expected <<EOF
63+
:100644 100644 $before0 $after0 M file0
6064
EOF
6165
test_expect_success \
6266
'limit to file0 should show file0' \

0 commit comments

Comments
 (0)