Skip to content

Commit 31fb3f4

Browse files
bk2204gitster
authored andcommitted
t4007: abstract away SHA-1-specific constants
Adjust the test so that it computes variables for blobs and uses the ZERO_OID variable instead of using hard-coded hashes. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f1aae03 commit 31fb3f4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

t/t4007-rename-3.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ test_expect_success 'prepare reference tree' '
1717
echo $tree
1818
'
1919

20+
blob=$(git hash-object "$TEST_DIRECTORY/diff-lib/COPYING")
2021
test_expect_success 'prepare work tree' '
2122
cp path0/COPYING path1/COPYING &&
2223
git update-index --add --remove path0/COPYING path1/COPYING
@@ -26,8 +27,8 @@ test_expect_success 'prepare work tree' '
2627
# path1 both have COPYING and the latter is a copy of path0/COPYING.
2728
# Comparing the full tree with cache should tell us so.
2829

29-
cat >expected <<\EOF
30-
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 C100 path0/COPYING path1/COPYING
30+
cat >expected <<EOF
31+
:100644 100644 $blob $blob C100 path0/COPYING path1/COPYING
3132
EOF
3233

3334
test_expect_success 'copy detection' '
@@ -46,8 +47,8 @@ test_expect_success 'copy detection, cached' '
4647
# path1/COPYING suddenly appearing from nowhere, not detected as
4748
# a copy from path0/COPYING.
4849

49-
cat >expected <<\EOF
50-
:000000 100644 0000000000000000000000000000000000000000 6ff87c4664981e4397625791c8ea3bbb5f2279a3 A path1/COPYING
50+
cat >expected <<EOF
51+
:000000 100644 $ZERO_OID $blob A path1/COPYING
5152
EOF
5253

5354
test_expect_success 'copy, limited to a subtree' '
@@ -64,8 +65,8 @@ test_expect_success 'tweak work tree' '
6465
# path0/COPYING. Showing the full tree with cache should tell us about
6566
# the rename.
6667

67-
cat >expected <<\EOF
68-
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100 path0/COPYING path1/COPYING
68+
cat >expected <<EOF
69+
:100644 100644 $blob $blob R100 path0/COPYING path1/COPYING
6970
EOF
7071

7172
test_expect_success 'rename detection' '
@@ -78,8 +79,8 @@ test_expect_success 'rename detection' '
7879
# path0/COPYING. When we say we care only about path1, we should just
7980
# see path1/COPYING appearing from nowhere.
8081

81-
cat >expected <<\EOF
82-
:000000 100644 0000000000000000000000000000000000000000 6ff87c4664981e4397625791c8ea3bbb5f2279a3 A path1/COPYING
82+
cat >expected <<EOF
83+
:000000 100644 $ZERO_OID $blob A path1/COPYING
8384
EOF
8485

8586
test_expect_success 'rename, limited to a subtree' '

0 commit comments

Comments
 (0)