Skip to content

Commit 0e54913

Browse files
Nicolas Pitregitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0e30404 commit 0e54913

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

builtin-prune-packed.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts)
1515
struct dirent *de;
1616
char hex[40];
1717

18+
if (opts == VERBOSE)
19+
display_progress(&progress, i + 1);
20+
1821
sprintf(hex, "%02x", i);
1922
while ((de = readdir(dir)) != NULL) {
2023
unsigned char sha1[20];
@@ -26,8 +29,6 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts)
2629
if (!has_sha1_pack(sha1, NULL))
2730
continue;
2831
memcpy(pathname + len, de->d_name, 38);
29-
if (opts == VERBOSE)
30-
display_progress(&progress, i + 1);
3132
if (opts & DRY_RUN)
3233
printf("rm -f %s\n", pathname);
3334
else if (unlink(pathname) < 0)

0 commit comments

Comments
 (0)