summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b04ba2b)
raw | patch | inline | side by side (parent: b04ba2b)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Sat, 5 Nov 2011 12:00:08 +0000 (19:00 +0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 8 Nov 2011 06:12:19 +0000 (22:12 -0800) |
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>
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>
builtin/prune.c | patch | blob | history | |
builtin/reflog.c | patch | blob | history | |
reachable.c | patch | blob | history | |
reachable.h | patch | blob | history |
diff --git a/builtin/prune.c b/builtin/prune.c
index e65690ba370511072dfa1e64838eef5e5686aac9..6b39d3fdebcc1a2e105da277e2b34956ebddf1d4 100644 (file)
--- a/builtin/prune.c
+++ b/builtin/prune.c
#include "builtin.h"
#include "reachable.h"
#include "parse-options.h"
+#include "progress.h"
#include "dir.h"
static const char * const prune_usage[] = {
int cmd_prune(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;
+ struct progress *progress;
const struct option options[] = {
OPT__DRY_RUN(&show_only, "do not remove, show only"),
OPT__VERBOSE(&verbose, "report pruned objects"),
else
die("unrecognized argument: %s", name);
}
- mark_reachable_objects(&revs, 1);
+ progress = start_progress_delay("Checking connectivity", 0, 0, 2);
+ mark_reachable_objects(&revs, 1, progress);
+ stop_progress(&progress);
prune_object_dir(get_object_directory());
prune_packed_objects(show_only);
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 3a9c80f3dbfe26d5623c118fc0fcaa257e01b973..062d7dad1b5af720e70adcaa05b60bf68977b05c 100644 (file)
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
init_revisions(&cb.revs, prefix);
if (cb.verbose)
printf("Marking reachable objects...");
- mark_reachable_objects(&cb.revs, 0);
+ mark_reachable_objects(&cb.revs, 0, NULL);
if (cb.verbose)
putchar('\n');
}
diff --git a/reachable.c b/reachable.c
index 3fc6b1d320faad3a528db016a0d800ff1bdde4f0..293d37d22481561b46cb8fbf747205a6ba73a420 100644 (file)
--- a/reachable.c
+++ b/reachable.c
#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;
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
*/
if (prepare_revision_walk(revs))
die("revision walk setup failed");
- walk_commit_list(revs);
+ walk_commit_list(revs, progress);
}
diff --git a/reachable.h b/reachable.h
index 40751810b64f8bbf9c0a633472a0ef27d23ed1a5..5d082adfecc47c40074212df2ddedc00d8a5ecb1 100644 (file)
--- a/reachable.h
+++ b/reachable.h
#ifndef REACHEABLE_H
#define REACHEABLE_H
-extern void mark_reachable_objects(struct rev_info *revs, int mark_reflog);
+struct progress;
+extern void mark_reachable_objects(struct rev_info *revs, int mark_reflog, struct progress *);
#endif