summaryrefslogtreecommitdiff
path: root/reachable.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-11-05 19:00:08 +0700
committerJunio C Hamano <gitster@pobox.com>2011-11-07 22:12:19 -0800
commitdc347195ccfbc87b6e445f5c31a5500e1df6c9b5 (patch)
tree88de64bfe9c15cb9d97e05afd8fa5e99cff7f45a /reachable.c
parentb04ba2bb42957f63567f530e092385f085b25e63 (diff)
downloadgit-dc347195ccfbc87b6e445f5c31a5500e1df6c9b5.tar.gz
prune: show progress while marking reachable objects
prune already shows progress meter while pruning. The marking part may take a few seconds or more, depending on repository size. Show progress meter during this time too. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reachable.c')
-rw-r--r--reachable.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/reachable.c b/reachable.c
index 3fc6b1d320..293d37d224 100644
--- a/reachable.c
+++ b/reachable.c
@@ -7,6 +7,7 @@
#include "revision.h"
#include "reachable.h"
#include "cache-tree.h"
+#include "progress.h"
static void process_blob(struct blob *blob,
struct object_array *p,
@@ -81,21 +82,25 @@ static void process_tag(struct tag *tag, struct object_array *p, const char *nam
add_object(tag->tagged, p, NULL, name);
}
-static void walk_commit_list(struct rev_info *revs)
+static void walk_commit_list(struct rev_info *revs, struct progress *progress)
{
int i;
struct commit *commit;
struct object_array objects = OBJECT_ARRAY_INIT;
+ uint32_t count = 0;
/* Walk all commits, process their trees */
- while ((commit = get_revision(revs)) != NULL)
+ while ((commit = get_revision(revs)) != NULL) {
process_tree(commit->tree, &objects, NULL, "");
+ display_progress(progress, ++count);
+ }
/* Then walk all the pending objects, recursively processing them too */
for (i = 0; i < revs->pending.nr; i++) {
struct object_array_entry *pending = revs->pending.objects + i;
struct object *obj = pending->item;
const char *name = pending->name;
+ display_progress(progress, ++count);
if (obj->type == OBJ_TAG) {
process_tag((struct tag *) obj, &objects, name);
continue;
@@ -191,7 +196,8 @@ static void add_cache_refs(struct rev_info *revs)
add_cache_tree(active_cache_tree, revs);
}
-void mark_reachable_objects(struct rev_info *revs, int mark_reflog)
+void mark_reachable_objects(struct rev_info *revs, int mark_reflog,
+ struct progress *progress)
{
/*
* Set up revision parsing, and mark us as being interested
@@ -217,5 +223,5 @@ void mark_reachable_objects(struct rev_info *revs, int mark_reflog)
*/
if (prepare_revision_walk(revs))
die("revision walk setup failed");
- walk_commit_list(revs);
+ walk_commit_list(revs, progress);
}