[PATCH 2/4] Make prune-packed use progress as well.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 builtin-prune-packed.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/builtin-prune-packed.c b/builtin-prune-packed.c
index 9777300..88bd062 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]";
@@ -34,6 +35,7 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts)
 
 void prune_packed_objects(int opts)
 {
+	struct progress progress;
 	int i;
 	static char pathname[PATH_MAX];
 	const char *dir = get_object_directory();
@@ -44,21 +46,23 @@ void prune_packed_objects(int opts)
 	memcpy(pathname, dir, len);
 	if (len && pathname[len-1] != '/')
 		pathname[len++] = '/';
+
+	if (opts == VERBOSE)
+		start_progress(&progress, "Pruning objects", 256);
 	for (i = 0; i < 256; i++) {
 		DIR *d;
 
 		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 (opts == VERBOSE)
+			display_progress(&progress, i + 1);
 		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)
-- 
1.5.3.2.1114.ga57c3

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux