1
0
mirror of https://github.com/git/git.git synced 2024-09-25 04:01:58 +02:00

t5510: make hash size independent

Use $OID_REGEX instead of hard-coding 40-based regular expressions.
Change invocations of cut with a hard-coded constant to split using a
delimiter instead.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson 2019-12-21 19:49:29 +00:00 committed by Junio C Hamano
parent cba472d3ad
commit ba1be1ab45

View File

@ -11,7 +11,7 @@ D=$(pwd)
test_bundle_object_count () {
git verify-pack -v "$1" >verify.out &&
test "$2" = $(grep '^[0-9a-f]\{40\} ' verify.out | wc -l)
test "$2" = $(grep "^$OID_REGEX " verify.out | wc -l)
}
convert_bundle_to_pack () {
@ -261,9 +261,10 @@ test_expect_success 'create bundle 1' '
'
test_expect_success 'header of bundle looks right' '
head -n 4 "$D"/bundle1 &&
head -n 1 "$D"/bundle1 | grep "^#" &&
head -n 2 "$D"/bundle1 | grep "^-[0-9a-f]\{40\} " &&
head -n 3 "$D"/bundle1 | grep "^[0-9a-f]\{40\} " &&
head -n 2 "$D"/bundle1 | grep "^-$OID_REGEX " &&
head -n 3 "$D"/bundle1 | grep "^$OID_REGEX " &&
head -n 4 "$D"/bundle1 | grep "^$"
'
@ -289,7 +290,7 @@ test_expect_success 'bundle 1 has only 3 files ' '
test_expect_success 'unbundle 2' '
cd "$D/bundle" &&
git fetch ../bundle2 master:master &&
test "tip" = "$(git log -1 --pretty=oneline master | cut -b42-)"
test "tip" = "$(git log -1 --pretty=oneline master | cut -d" " -f2)"
'
test_expect_success 'bundle does not prerequisite objects' '