@matheusbsbs / matheus-bagliano / commits / 0e54913796
Fork 0

prune-packed: don't call display_progress() for every file

The progress count is per fanout directory, so it is useless to call it for every file as the count doesn't change that often. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nicolas Pitre committed Oct 30, 2007 at 14:57 UTC 0e549137966feb016927a827fb6e359aec8264a3
1 file changed +3 -2
builtin-prune-packed.c
+3 -2
@@ -15,6 +15,9 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts)
15 struct dirent *de;
16 char hex[40];
17
18 + if (opts == VERBOSE)
19 + display_progress(&progress, i + 1);
20 +
21 sprintf(hex, "%02x", i);
22 while ((de = readdir(dir)) != NULL) {
23 unsigned char sha1[20];
@@ -26,8 +29,6 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts)
29 if (!has_sha1_pack(sha1, NULL))
30 continue;
31 memcpy(pathname + len, de->d_name, 38);
29 - if (opts == VERBOSE)
30 - display_progress(&progress, i + 1);
32 if (opts & DRY_RUN)
33 printf("rm -f %s\n", pathname);
34 else if (unlink(pathname) < 0)