aboutsummaryrefslogtreecommitdiffstats
path: root/midx.c
diff options
context:
space:
mode:
authorWilliam Baker <William.Baker@microsoft.com>2019-10-21 18:40:00 +0000
committerJunio C Hamano <gitster@pobox.com>2019-10-23 12:05:05 +0900
commit8dc18f8937faf542da785b28062731ddfbfee974 (patch)
tree5f251f75a54a8cd9214191bd6916c1f2ddefa949 /midx.c
parent840cef0c70e4c664d814d09f304d4be9a63d11e4 (diff)
downloadgit-8dc18f8937faf542da785b28062731ddfbfee974.tar.gz
midx: add progress to expire_midx_packs
Add progress to expire_midx_packs. Progress is displayed when the MIDX_PROGRESS flag is set. Signed-off-by: William Baker <William.Baker@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/midx.c b/midx.c
index 716aeecefb..cb2c602603 100644
--- a/midx.c
+++ b/midx.c
@@ -1205,18 +1205,29 @@ int expire_midx_packs(struct repository *r, const char *object_dir, unsigned fla
uint32_t i, *count, result = 0;
struct string_list packs_to_drop = STRING_LIST_INIT_DUP;
struct multi_pack_index *m = load_multi_pack_index(object_dir, 1);
+ struct progress *progress = NULL;
if (!m)
return 0;
count = xcalloc(m->num_packs, sizeof(uint32_t));
+
+ if (flags & MIDX_PROGRESS)
+ progress = start_progress(_("Counting referenced objects"),
+ m->num_objects);
for (i = 0; i < m->num_objects; i++) {
int pack_int_id = nth_midxed_pack_int_id(m, i);
count[pack_int_id]++;
+ display_progress(progress, i + 1);
}
+ stop_progress(&progress);
+ if (flags & MIDX_PROGRESS)
+ progress = start_progress(_("Finding and deleting unreferenced packfiles"),
+ m->num_packs);
for (i = 0; i < m->num_packs; i++) {
char *pack_name;
+ display_progress(progress, i + 1);
if (count[i])
continue;
@@ -1234,6 +1245,7 @@ int expire_midx_packs(struct repository *r, const char *object_dir, unsigned fla
unlink_pack_path(pack_name, 0);
free(pack_name);
}
+ stop_progress(&progress);
free(count);