summaryrefslogtreecommitdiffstats
path: root/midx.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2018-09-13 11:02:26 -0700
committerJunio C Hamano <gitster@pobox.com>2018-09-17 13:49:41 -0700
commit144d70333e826ea2480d60eb2298013eeef0cabf (patch)
tree49b0a1725156f777f902370ac1fc27856225babb /midx.c
parentcc6af73c029da23f7b2c98c60e4fba1ca2db215b (diff)
downloadgit-144d70333e826ea2480d60eb2298013eeef0cabf.tar.gz
git-144d70333e826ea2480d60eb2298013eeef0cabf.tar.xz
multi-pack-index: report progress during 'verify'
When verifying a multi-pack-index, the only action that takes significant time is checking the object offsets. For example, to verify a multi-pack-index containing 6.2 million objects in the Linux kernel repository takes 1.3 seconds on my machine. 99% of that time is spent looking up object offsets in each of the packfiles and comparing them to the multi-pack-index offset. Add a progress indicator for that section of the 'verify' verb. 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.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/midx.c b/midx.c
index ef4a6969d..713d6f9dd 100644
--- a/midx.c
+++ b/midx.c
@@ -7,6 +7,7 @@
#include "object-store.h"
#include "sha1-lookup.h"
#include "midx.h"
+#include "progress.h"
#define MIDX_SIGNATURE 0x4d494458 /* "MIDX" */
#define MIDX_VERSION 1
@@ -940,6 +941,7 @@ static void midx_report(const char *fmt, ...)
int verify_midx_file(const char *object_dir)
{
uint32_t i;
+ struct progress *progress = NULL;
struct multi_pack_index *m = load_multi_pack_index(object_dir, 1);
verify_midx_error = 0;
@@ -971,6 +973,7 @@ int verify_midx_file(const char *object_dir)
i, oid_to_hex(&oid1), oid_to_hex(&oid2), i + 1);
}
+ progress = start_progress(_("Verifying object offsets"), m->num_objects);
for (i = 0; i < m->num_objects; i++) {
struct object_id oid;
struct pack_entry e;
@@ -995,7 +998,10 @@ int verify_midx_file(const char *object_dir)
if (m_offset != p_offset)
midx_report(_("incorrect object offset for oid[%d] = %s: %"PRIx64" != %"PRIx64),
i, oid_to_hex(&oid), m_offset, p_offset);
+
+ display_progress(progress, i + 1);
}
+ stop_progress(&progress);
return verify_midx_error;
}