From 3bbbe467f294fae8a286e47af676fa783ad970c1 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 27 May 2019 12:59:14 -0700 Subject: 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 Signed-off-by: Junio C Hamano --- bundle.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bundle.c') diff --git a/bundle.c b/bundle.c index b45666c49b..b5d21cd80f 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; -- cgit v1.2.3