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 <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
May 21, 2018 at 02:01 UTC
31fb3f42960b515af09139f54d34af00645118b5
1 file changed
+9
-8
t/t4007-rename-3.sh
+9
-8
@@ -17,6 +17,7 @@ test_expect_success 'prepare reference tree' '
17
echo $tree
18
'
19
20
+blob=$(git hash-object "$TEST_DIRECTORY/diff-lib/COPYING")
21
test_expect_success 'prepare work tree' '
22
cp path0/COPYING path1/COPYING &&
23
git update-index --add --remove path0/COPYING path1/COPYING
@@ -26,8 +27,8 @@ test_expect_success 'prepare work tree' '
27
# path1 both have COPYING and the latter is a copy of path0/COPYING.
28
# Comparing the full tree with cache should tell us so.
29
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
32
EOF
33
34
test_expect_success 'copy detection' '
@@ -46,8 +47,8 @@ test_expect_success 'copy detection, cached' '
47
# path1/COPYING suddenly appearing from nowhere, not detected as
48
# a copy from path0/COPYING.
49
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
52
EOF
53
54
test_expect_success 'copy, limited to a subtree' '
@@ -64,8 +65,8 @@ test_expect_success 'tweak work tree' '
65
# path0/COPYING. Showing the full tree with cache should tell us about
66
# the rename.
67
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
70
EOF
71
72
test_expect_success 'rename detection' '
@@ -78,8 +79,8 @@ test_expect_success 'rename detection' '
79
# path0/COPYING. When we say we care only about path1, we should just
80
# see path1/COPYING appearing from nowhere.
81
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
84
EOF
85
86
test_expect_success 'rename, limited to a subtree' '