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>
brian m. carlson committed
Dec 21, 2019 at 19:49 UTC
ba1be1ab45801db55e5b9e66194a82ffcc76b5f0
1 file changed
+5
-4
t/t5510-fetch.sh
+5
-4
@@ -11,7 +11,7 @@ D=$(pwd)
11
12
test_bundle_object_count () {
13
git verify-pack -v "$1" >verify.out &&
14
- test "$2" = $(grep '^[0-9a-f]\{40\} ' verify.out | wc -l)
14
+ test "$2" = $(grep "^$OID_REGEX " verify.out | wc -l)
15
}
16
17
convert_bundle_to_pack () {
@@ -261,9 +261,10 @@ test_expect_success 'create bundle 1' '
261
'
262
263
test_expect_success 'header of bundle looks right' '
264
+ head -n 4 "$D"/bundle1 &&
265
head -n 1 "$D"/bundle1 | grep "^#" &&
265
- head -n 2 "$D"/bundle1 | grep "^-[0-9a-f]\{40\} " &&
266
- head -n 3 "$D"/bundle1 | grep "^[0-9a-f]\{40\} " &&
266
+ head -n 2 "$D"/bundle1 | grep "^-$OID_REGEX " &&
267
+ head -n 3 "$D"/bundle1 | grep "^$OID_REGEX " &&
268
head -n 4 "$D"/bundle1 | grep "^$"
269
'
270
@@ -289,7 +290,7 @@ test_expect_success 'bundle 1 has only 3 files ' '
290
test_expect_success 'unbundle 2' '
291
cd "$D/bundle" &&
292
git fetch ../bundle2 master:master &&
292
- test "tip" = "$(git log -1 --pretty=oneline master | cut -b42-)"
293
+ test "tip" = "$(git log -1 --pretty=oneline master | cut -d" " -f2)"
294
'
295
296
test_expect_success 'bundle does not prerequisite objects' '