Skip to content

Commit 371c407

Browse files
bk2204gitster
authored andcommitted
t5300: pass --object-format to git index-pack
git index-pack by default reads the repository to determine the object format. However, when outside of a repository, it's necessary to specify the hash algorithm in use so that the pack can be properly indexed. Add an --object-format argument when invoking git index-pack outside of a repository. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4ddd3f5 commit 371c407

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

t/t5300-pack-object.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ TRASH=$(pwd)
1212

1313
test_expect_success \
1414
'setup' \
15-
'rm -f .git/index* &&
15+
'test_oid_init &&
16+
rm -f .git/index* &&
1617
perl -e "print \"a\" x 4096;" > a &&
1718
perl -e "print \"b\" x 4096;" > b &&
1819
perl -e "print \"c\" x 4096;" > c &&
@@ -412,18 +413,18 @@ test_expect_success 'set up pack for non-repo tests' '
412413
'
413414

414415
test_expect_success 'index-pack --stdin complains of non-repo' '
415-
nongit test_must_fail git index-pack --stdin <foo.pack &&
416+
nongit test_must_fail git index-pack --object-format=$(test_oid algo) --stdin <foo.pack &&
416417
test_path_is_missing non-repo/.git
417418
'
418419

419420
test_expect_success 'index-pack <pack> works in non-repo' '
420-
nongit git index-pack ../foo.pack &&
421+
nongit git index-pack --object-format=$(test_oid algo) ../foo.pack &&
421422
test_path_is_file foo.idx
422423
'
423424

424425
test_expect_success 'index-pack --strict <pack> works in non-repo' '
425426
rm -f foo.idx &&
426-
nongit git index-pack --strict ../foo.pack &&
427+
nongit git index-pack --strict --object-format=$(test_oid algo) ../foo.pack &&
427428
test_path_is_file foo.idx
428429
'
429430

0 commit comments

Comments
 (0)