aboutsummaryrefslogtreecommitdiffstats
path: root/midx.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2018-09-13 11:02:19 -0700
committerJunio C Hamano <gitster@pobox.com>2018-09-17 13:49:41 -0700
commitd4bf1d88b9020d3921ac4e4d8a8fd6ca5015b243 (patch)
tree864503e40650f3d5de7487506a1e6a787a136920 /midx.c
parent8e72a3c321eb70caad036e45664de9ea10839b93 (diff)
downloadgit-d4bf1d88b9020d3921ac4e4d8a8fd6ca5015b243.tar.gz
multi-pack-index: verify missing pack
Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/midx.c b/midx.c
index 939e8fa391..01f4d694d2 100644
--- a/midx.c
+++ b/midx.c
@@ -926,13 +926,29 @@ void clear_midx_file(const char *object_dir)
static int verify_midx_error;
+static void midx_report(const char *fmt, ...)
+{
+ va_list ap;
+ verify_midx_error = 1;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+}
+
int verify_midx_file(const char *object_dir)
{
+ uint32_t i;
struct multi_pack_index *m = load_multi_pack_index(object_dir, 1);
verify_midx_error = 0;
if (!m)
return 0;
+ for (i = 0; i < m->num_packs; i++) {
+ if (prepare_midx_pack(m, i))
+ midx_report("failed to load pack in position %d", i);
+ }
+
return verify_midx_error;
}