t4009: make hash size independent
Instead of hard-coding object IDs, compute them and use those in the comparison. Note that the comparison code ignores the actual object IDs, but does check that they're the right size, so computing them is the easiest way to ensure that they are. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Aug 26, 2019 at 01:43 UTC
0c37c41d1395fac7e715d1b6859828e2c0bf00f4
1 file changed
+11
-8
t/t4009-diff-rename-4.sh
+11
-8
@@ -14,6 +14,7 @@ test_expect_success \
14
'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
15
echo frotz >rezrov &&
16
git update-index --add COPYING rezrov &&
17
+ orig=$(git hash-object COPYING) &&
18
tree=$(git write-tree) &&
19
echo $tree'
20
@@ -22,6 +23,8 @@ test_expect_success \
23
'sed -e 's/HOWEVER/However/' <COPYING >COPYING.1 &&
24
sed -e 's/GPL/G.P.L/g' <COPYING >COPYING.2 &&
25
rm -f COPYING &&
26
+ c1=$(git hash-object COPYING.1) &&
27
+ c2=$(git hash-object COPYING.2) &&
28
git update-index --add --remove COPYING COPYING.?'
29
30
# tree has COPYING and rezrov. work tree has COPYING.1 and COPYING.2,
@@ -31,11 +34,11 @@ test_expect_success \
34
35
git diff-index -z -C $tree >current
36
34
-cat >expected <<\EOF
35
-:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234
37
+cat >expected <<EOF
38
+:100644 100644 $orig $c1 C1234
39
COPYING
40
COPYING.1
38
-:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 06c67961bbaed34a127f76d261f4c0bf73eda471 R1234
41
+:100644 100644 $orig $c2 R1234
42
COPYING
43
COPYING.2
44
EOF
@@ -57,10 +60,10 @@ test_expect_success \
60
# about rezrov.
61
62
git diff-index -z -C $tree >current
60
-cat >expected <<\EOF
61
-:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 06c67961bbaed34a127f76d261f4c0bf73eda471 M
63
+cat >expected <<EOF
64
+:100644 100644 $orig $c2 M
65
COPYING
63
-:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234
66
+:100644 100644 $orig $c1 C1234
67
COPYING
68
COPYING.1
69
EOF
@@ -82,8 +85,8 @@ test_expect_success \
85
git update-index --add --remove COPYING COPYING.1'
86
87
git diff-index -z -C --find-copies-harder $tree >current
85
-cat >expected <<\EOF
86
-:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234
88
+cat >expected <<EOF
89
+:100644 100644 $orig $c1 C1234
90
COPYING
91
COPYING.1
92
EOF