diff options
| -rw-r--r-- | include/git2/indexer.h | 3 | ||||
| -rw-r--r-- | src/indexer.c | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/git2/indexer.h b/include/git2/indexer.h index 53a59fc81..94d8785c0 100644 --- a/include/git2/indexer.h +++ b/include/git2/indexer.h @@ -22,6 +22,9 @@ typedef struct git_indexer_options { git_transfer_progress_cb progress_cb; /** progress_cb_payload payload for the progress callback */ void *progress_cb_payload; + + /** Do connectivity checks for the received pack */ + unsigned char verify; } git_indexer_options; #define GIT_INDEXER_OPTIONS_VERSION 1 diff --git a/src/indexer.c b/src/indexer.c index fc9a3bbff..019682c79 100644 --- a/src/indexer.c +++ b/src/indexer.c @@ -148,7 +148,7 @@ int git_indexer_new( idx->expected_oids = git_oidmap_alloc(); GITERR_CHECK_ALLOC(idx->expected_oids); - idx->do_verify = !!idx->odb; + idx->do_verify = opts.verify; if (git_repository__fsync_gitdir) idx->do_fsync = 1; @@ -315,7 +315,7 @@ static void add_expected_oid(git_indexer *idx, const git_oid *oid) * because we have already processed it as part of our pack file, we do * not have to expect it. */ - if (!git_odb_exists(idx->odb, oid) && + if ((!idx->odb || !git_odb_exists(idx->odb, oid)) && !git_oidmap_exists(idx->pack->idx_cache, oid) && !git_oidmap_exists(idx->expected_oids, oid)) { git_oid *dup = git__malloc(sizeof(*oid)); @@ -350,7 +350,7 @@ static int check_object_connectivity(git_indexer *idx, const git_rawobj *obj) * Check whether this is a known object. If so, we can just continue as * we assume that the ODB has a complete graph. */ - if (git_odb_exists(idx->odb, &object->cached.oid)) + if (idx->odb && git_odb_exists(idx->odb, &object->cached.oid)) return 0; switch (obj->type) { |
