Skip to content

Commit b471c5c

Browse files
committed
bundle verify: error out if called without an object database
Bundles really are thin packs (i.e. in general, they require an object database to reconstruct deltified objects), with very little sugar on top. So we really need a repository (or more appropriately, an object database) to work with, when asked to verify a bundle. Let's error out with a useful error message if `git bundle verify` is called without such an object database to work with. Reported by Konstantin Ryabitsev. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 8104ec9 commit b471c5c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

builtin/bundle.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
4040
usage(builtin_bundle_usage);
4141
return 1;
4242
}
43+
if (!startup_info->have_repository)
44+
die(_("Need a repository to create a bundle."));
4345
if (verify_bundle(the_repository, &header, 1))
4446
return 1;
4547
fprintf(stderr, _("%s is okay\n"), bundle_file);

t/t5607-clone-bundle.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ test_expect_success 'setup' '
1414
git tag -d third
1515
'
1616

17+
test_expect_success '"verify" needs a repository' '
18+
git bundle create tip.bundle -1 master &&
19+
test_must_fail nongit git bundle verify ../tip.bundle 2>err &&
20+
test_i18ngrep "Need a repository" err
21+
'
22+
1723
test_expect_success 'annotated tags can be excluded by rev-list options' '
1824
git bundle create bundle --all --since=7.Apr.2005.15:14:00.-0700 &&
1925
git ls-remote bundle > output &&

0 commit comments

Comments
 (0)