Skip to content

Commit d341e08

Browse files
bk2204gitster
authored andcommitted
t5703: make test work with SHA-256
This test used an object ID which was 40 hex characters in length, causing the test not only not to pass, but to hang, when run with SHA-256 as the hash. Change this value to a fixed dummy object ID using test_oid_init and test_oid. Furthermore, ensure we extract an object ID of the appropriate length using cut with fields instead of a fixed length. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 88ed241 commit d341e08

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

t/t5703-upload-pack-ref-in-want.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ get_actual_commits () {
1919
}' <out | test-tool pkt-line unpack-sideband >o.pack &&
2020
git index-pack o.pack &&
2121
git verify-pack -v o.idx >objs &&
22-
grep commit objs | cut -c-40 | sort >actual_commits
22+
grep commit objs | cut -d" " -f1 | sort >actual_commits
2323
}
2424

2525
check_output () {
@@ -37,6 +37,7 @@ check_output () {
3737
# \ | /
3838
# a
3939
test_expect_success 'setup repository' '
40+
test_oid_init &&
4041
test_commit a &&
4142
git checkout -b o/foo &&
4243
test_commit b &&
@@ -333,7 +334,7 @@ test_expect_success 'server is initially ahead - no ref in want' '
333334
git -C "$REPO" config uploadpack.allowRefInWant false &&
334335
rm -rf local &&
335336
cp -r "$LOCAL_PRISTINE" local &&
336-
inconsistency master 1234567890123456789012345678901234567890 &&
337+
inconsistency master $(test_oid numeric) &&
337338
test_must_fail git -C local fetch 2>err &&
338339
test_i18ngrep "fatal: remote error: upload-pack: not our ref" err
339340
'
@@ -342,7 +343,7 @@ test_expect_success 'server is initially ahead - ref in want' '
342343
git -C "$REPO" config uploadpack.allowRefInWant true &&
343344
rm -rf local &&
344345
cp -r "$LOCAL_PRISTINE" local &&
345-
inconsistency master 1234567890123456789012345678901234567890 &&
346+
inconsistency master $(test_oid numeric) &&
346347
git -C local fetch &&
347348
348349
git -C "$REPO" rev-parse --verify master >expected &&

0 commit comments

Comments
 (0)