diff --git a/builtin/bundle.c b/builtin/bundle.c index 1ea4bfdfc19868..4eb051f74610c9 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -40,6 +40,8 @@ int cmd_bundle(int argc, const char **argv, const char *prefix) usage(builtin_bundle_usage); return 1; } + if (!startup_info->have_repository) + die(_("Need a repository to create a bundle.")); if (verify_bundle(the_repository, &header, 1)) return 1; fprintf(stderr, _("%s is okay\n"), bundle_file); diff --git a/t/t5607-clone-bundle.sh b/t/t5607-clone-bundle.sh index cf39e9e2437f06..4281147c0c577d 100755 --- a/t/t5607-clone-bundle.sh +++ b/t/t5607-clone-bundle.sh @@ -14,6 +14,12 @@ test_expect_success 'setup' ' git tag -d third ' +test_expect_success '"verify" needs a repository' ' + git bundle create tip.bundle -1 master && + test_must_fail nongit git bundle verify ../tip.bundle 2>err && + test_i18ngrep "Need a repository" err +' + test_expect_success 'annotated tags can be excluded by rev-list options' ' git bundle create bundle --all --since=7.Apr.2005.15:14:00.-0700 && git ls-remote bundle > output &&