Skip to content

Commit 0c37c41

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c1f3dfc commit 0c37c41

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

t/t4009-diff-rename-4.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ test_expect_success \
1414
'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
1515
echo frotz >rezrov &&
1616
git update-index --add COPYING rezrov &&
17+
orig=$(git hash-object COPYING) &&
1718
tree=$(git write-tree) &&
1819
echo $tree'
1920

@@ -22,6 +23,8 @@ test_expect_success \
2223
'sed -e 's/HOWEVER/However/' <COPYING >COPYING.1 &&
2324
sed -e 's/GPL/G.P.L/g' <COPYING >COPYING.2 &&
2425
rm -f COPYING &&
26+
c1=$(git hash-object COPYING.1) &&
27+
c2=$(git hash-object COPYING.2) &&
2528
git update-index --add --remove COPYING COPYING.?'
2629

2730
# tree has COPYING and rezrov. work tree has COPYING.1 and COPYING.2,
@@ -31,11 +34,11 @@ test_expect_success \
3134

3235
git diff-index -z -C $tree >current
3336

34-
cat >expected <<\EOF
35-
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234
37+
cat >expected <<EOF
38+
:100644 100644 $orig $c1 C1234
3639
COPYING
3740
COPYING.1
38-
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 06c67961bbaed34a127f76d261f4c0bf73eda471 R1234
41+
:100644 100644 $orig $c2 R1234
3942
COPYING
4043
COPYING.2
4144
EOF
@@ -57,10 +60,10 @@ test_expect_success \
5760
# about rezrov.
5861

5962
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
6265
COPYING
63-
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234
66+
:100644 100644 $orig $c1 C1234
6467
COPYING
6568
COPYING.1
6669
EOF
@@ -82,8 +85,8 @@ test_expect_success \
8285
git update-index --add --remove COPYING COPYING.1'
8386

8487
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
8790
COPYING
8891
COPYING.1
8992
EOF

0 commit comments

Comments
 (0)