git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/5] prune-packed: don't call display_progress() for every file

From
Nicolas Pitre <nico@cam.org>
Date
Oct 30, 2007, 18:57 UTC
Message-ID
<1193770655-20492-2-git-send-email-nico@cam.org>
In-Reply-To
<1193770655-20492-1-git-send-email-nico@cam.org>

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>
---
 builtin-prune-packed.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/builtin-prune-packed.c b/builtin-prune-packed.c
index 015c8bb..907e368 100644
--- a/builtin-prune-packed.c
+++ b/builtin-prune-packed.c
@@ -15,6 +15,9 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts)
 	struct dirent *de;
 	char hex[40];
 
+	if (opts == VERBOSE)
+		display_progress(&progress, i + 1);
+
 	sprintf(hex, "%02x", i);
 	while ((de = readdir(dir)) != NULL) {
 		unsigned char sha1[20];
@@ -26,8 +29,6 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts)
 		if (!has_sha1_pack(sha1, NULL))
 			continue;
 		memcpy(pathname + len, de->d_name, 38);
-		if (opts == VERBOSE)
-			display_progress(&progress, i + 1);
 		if (opts & DRY_RUN)
 			printf("rm -f %s\n", pathname);
 		else if (unlink(pathname) < 0)
-- 
1.5.3.4.1463.gf79ad2
Previous: Nicolas PitreNext: Nicolas Pitre
Message 2 of 11 in “more progress display stuff”
  1. 0/5 more progress display stuffNicolas Pitre, Oct 30, 2007
  2. 1/5 prune-packed: don't call display_progress() for every fileNicolas Pitre, Oct 30, 2007
  3. 2/5 make struct progress an opaque typeNicolas Pitre, Oct 30, 2007
  4. 3/5 relax usage of the progress APINicolas Pitre, Oct 30, 2007
  5. 4/5 add throughput to progress displayNicolas Pitre, Oct 30, 2007
  6. 5/5 add throughput display to index-packNicolas Pitre, Oct 30, 2007
  7. 6/5 add some copyright notice to the progress display codeNicolas Pitre, Oct 30, 2007
  8. 7/5 add throughput display to git-pushNicolas Pitre, Oct 30, 2007
  9. Junio C HamanoOct 31, 2007
  10. Shawn O. PearceNov 1, 2007
  11. Nicolas PitreNov 1, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.