On Thu, Sep 24, 2015 at 05:08:32PM -0400, Jeff King wrote:
> +static int fsck_subdir(int nr, const char *path, void *progress)
> +{
> + display_progress(progress, nr + 1);
> + return 0;
> +}
> +
> static void fsck_object_dir(const char *path)
> {
> - int i;
> struct progress *progress = NULL;
>
> if (verbose)
> @@ -501,12 +481,9 @@ static void fsck_object_dir(const char *path)
>
> if (show_progress)
> progress = start_progress(_("Checking object directories"),
> 256);
> - for (i = 0; i < 256; i++) {
> - static char dir[4096];
> - sprintf(dir, "%s/%02x", path, i);
> - fsck_dir(i, dir);
> - display_progress(progress, i+1);
> - }
> +
> + for_each_loose_file_in_objdir(path, fsck_loose, fsck_cruft, fsck_subdir,
> + progress);
> stop_progress(&progress);
I happened to be running git-fsck today and noticed that it finished
with the progress bar still reading 94%. The problem is that we update
the progress when we finish a subdir, but of course we do not
necessarily have all 256 subdirs, and the for_each_loose code only
triggers our callback for ones that exist.
So we need this on top:
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 2fe6a31..d50efd5 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -484,6 +484,7 @@ static void fsck_object_dir(const char *path)
for_each_loose_file_in_objdir(path, fsck_loose, fsck_cruft, fsck_subdir,
progress);
+ display_progress(progress, 256);
stop_progress(&progress);
}
to make things pretty.
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html