summaryrefslogtreecommitdiff
path: root/bundle.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-05-27 19:59:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-28 20:04:14 (GMT)
commit3bbbe467f294fae8a286e47af676fa783ad970c1 (patch)
tree75c51be85dedf69a1f75d4ae318e99b05e226b32 /bundle.c
parentaeb582a98374c094361cba1bd756dc6307432c42 (diff)
downloadgit-3bbbe467f294fae8a286e47af676fa783ad970c1.zip
git-3bbbe467f294fae8a286e47af676fa783ad970c1.tar.gz
git-3bbbe467f294fae8a286e47af676fa783ad970c1.tar.bz2
bundle verify: error out if called without an object database
The deal with bundles is: they really are thin packs, 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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bundle.c')
-rw-r--r--bundle.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bundle.c b/bundle.c
index b45666c..b5d21cd 100644
--- a/bundle.c
+++ b/bundle.c
@@ -142,6 +142,9 @@ int verify_bundle(struct repository *r,
int i, ret = 0, req_nr;
const char *message = _("Repository lacks these prerequisite commits:");
+ if (!r || !r->objects || !r->objects->odb)
+ return error(_("need a repository to verify a bundle"));
+
repo_init_revisions(r, &revs, NULL);
for (i = 0; i < p->nr; i++) {
struct ref_list_entry *e = p->list + i;