check_connected: add progress flag

Connectivity checks have to traverse the entire object graph in the worst case (e.g., a full clone or a full push). For large repositories like linux.git, this can take 30-60 seconds, during which time git may produce little or no output. Let's add the option of showing progress, which is taken care of by rev-list. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jul 15, 2016 at 06:32 UTC 70d5e2d77b4c2afdb442b37924bc252793e106d9
2 files changed +6
connected.c
+3
@@ -58,6 +58,9 @@ int check_connected(sha1_iterate_fn fn, void *cb_data,
58 argv_array_push(&rev_list.args, "--not");
59 argv_array_push(&rev_list.args, "--all");
60 argv_array_push(&rev_list.args, "--quiet");
61 + if (opt->progress)
62 + argv_array_pushf(&rev_list.args, "--progress=%s",
63 + _("Checking connectivity"));
64
65 rev_list.git_cmd = 1;
66 rev_list.in = -1;
connected.h
+3
@@ -30,6 +30,9 @@ struct check_connected_options {
30 * returns.
31 */
32 int err_fd;
33 +
34 + /* If non-zero, show progress as we traverse the objects. */
35 + int progress;
36 };
37
38 #define CHECK_CONNECTED_INIT { 0 }