Browse Source

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>
maint
brian m. carlson 6 years ago committed by Junio C Hamano
parent
commit
0c37c41d13
  1. 19
      t/t4009-diff-rename-4.sh

19
t/t4009-diff-rename-4.sh

@ -14,6 +14,7 @@ test_expect_success \
'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING && 'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
echo frotz >rezrov && echo frotz >rezrov &&
git update-index --add COPYING rezrov && git update-index --add COPYING rezrov &&
orig=$(git hash-object COPYING) &&
tree=$(git write-tree) && tree=$(git write-tree) &&
echo $tree' echo $tree'


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


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


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


cat >expected <<\EOF cat >expected <<EOF
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234 :100644 100644 $orig $c1 C1234
COPYING COPYING
COPYING.1 COPYING.1
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 06c67961bbaed34a127f76d261f4c0bf73eda471 R1234 :100644 100644 $orig $c2 R1234
COPYING COPYING
COPYING.2 COPYING.2
EOF EOF
@ -57,10 +60,10 @@ test_expect_success \
# about rezrov. # about rezrov.


git diff-index -z -C $tree >current git diff-index -z -C $tree >current
cat >expected <<\EOF cat >expected <<EOF
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 06c67961bbaed34a127f76d261f4c0bf73eda471 M :100644 100644 $orig $c2 M
COPYING COPYING
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234 :100644 100644 $orig $c1 C1234
COPYING COPYING
COPYING.1 COPYING.1
EOF EOF
@ -82,8 +85,8 @@ test_expect_success \
git update-index --add --remove COPYING COPYING.1' git update-index --add --remove COPYING COPYING.1'


git diff-index -z -C --find-copies-harder $tree >current git diff-index -z -C --find-copies-harder $tree >current
cat >expected <<\EOF cat >expected <<EOF
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234 :100644 100644 $orig $c1 C1234
COPYING COPYING
COPYING.1 COPYING.1
EOF EOF

Loading…
Cancel
Save