]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t5510: make hash size independent
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sat, 21 Dec 2019 19:49:29 +0000 (19:49 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Jan 2020 22:06:19 +0000 (14:06 -0800)
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>
t/t5510-fetch.sh

index 4b602826895e21154376391333c6517b4ec1ec54..2ceae1416430331a81c861a6a1b30ac056a0cdb7 100755 (executable)
@@ -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' '