]> git.ipfire.org Git - thirdparty/git.git/blobdiff - pack-check.c
Lazily open pack index files on demand
[thirdparty/git.git] / pack-check.c
index c168642c0c0d9479b1ccc8564ce6c80c9055ab00..3623c716e3e3b7d4a28800e34afd0e5f0e13a43d 100644 (file)
@@ -128,12 +128,17 @@ static void show_pack_info(struct packed_git *p)
 
 int verify_pack(struct packed_git *p, int verbose)
 {
-       off_t index_size = p->index_size;
-       const unsigned char *index_base = p->index_data;
+       off_t index_size;
+       const unsigned char *index_base;
        SHA_CTX ctx;
        unsigned char sha1[20];
        int ret;
 
+       if (open_pack_index(p))
+               return error("packfile %s index not opened", p->pack_name);
+       index_size = p->index_size;
+       index_base = p->index_data;
+
        ret = 0;
        /* Verify SHA1 sum of the index file */
        SHA1_Init(&ctx);