diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-11-02 16:27:37 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-11-02 16:27:37 -0700 |
commit | 265ae188267fda441f92e513fb89641f78e982fd (patch) | |
tree | 0286ec09fc86fea191aea74b0f4864ab10380253 /builtin-prune-packed.c | |
parent | 7240bfeaf7eccc6d2c4b2df07b7f33caa547953c (diff) | |
parent | 81f6654a47075a345ba63a394921f77fc87b6500 (diff) | |
download | git-265ae188267fda441f92e513fb89641f78e982fd.tar.gz |
Merge branch 'np/progress'
* np/progress:
Show total transferred as part of throughput progress
make sure throughput display gets updated even if progress doesn't move
return the prune-packed progress display to the inner loop
add throughput display to git-push
add some copyright notice to the progress display code
add throughput display to index-pack
add throughput to progress display
relax usage of the progress API
make struct progress an opaque type
prune-packed: don't call display_progress() for every file
Stop displaying "Pack pack-$ID created." during git-gc
Teach prune-packed to use the standard progress meter
Change 'Deltifying objects' to 'Compressing objects'
fix for more minor memory leaks
fix const issues with some functions
pack-objects.c: fix some global variable abuse and memory leaks
pack-objects: no delta possible with only one object in the list
cope with multiple line breaks within sideband progress messages
more compact progress display
Diffstat (limited to 'builtin-prune-packed.c')
-rw-r--r-- | builtin-prune-packed.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/builtin-prune-packed.c b/builtin-prune-packed.c index 977730064b..23faf3129f 100644 --- a/builtin-prune-packed.c +++ b/builtin-prune-packed.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "cache.h" +#include "progress.h" static const char prune_packed_usage[] = "git-prune-packed [-n] [-q]"; @@ -7,6 +8,8 @@ static const char prune_packed_usage[] = #define DRY_RUN 01 #define VERBOSE 02 +static struct progress *progress; + static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts) { struct dirent *de; @@ -27,6 +30,7 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts) printf("rm -f %s\n", pathname); else if (unlink(pathname) < 0) error("unable to unlink %s", pathname); + display_progress(progress, i + 1); } pathname[len] = 0; rmdir(pathname); @@ -39,6 +43,10 @@ void prune_packed_objects(int opts) const char *dir = get_object_directory(); int len = strlen(dir); + if (opts == VERBOSE) + progress = start_progress_delay("Removing duplicate objects", + 256, 95, 2); + if (len > PATH_MAX - 42) die("impossible object directory"); memcpy(pathname, dir, len); @@ -49,16 +57,12 @@ void prune_packed_objects(int opts) sprintf(pathname + len, "%02x/", i); d = opendir(pathname); - if (opts == VERBOSE && (d || i == 255)) - fprintf(stderr, "Removing unused objects %d%%...\015", - ((i+1) * 100) / 256); if (!d) continue; prune_dir(i, d, pathname, len + 3, opts); closedir(d); } - if (opts == VERBOSE) - fprintf(stderr, "\nDone.\n"); + stop_progress(&progress); } int cmd_prune_packed(int argc, const char **argv, const char *prefix) |