check_everything_connected: always pass --quiet to rev-list
authorJeff King <peff@peff.net>
Fri, 15 Jul 2016 10:26:29 +0000 (06:26 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Jul 2016 19:09:31 +0000 (12:09 -0700)
The check_everything_connected function takes a "quiet"
parameter which does two things if non-zero:

1. redirect rev-list's stderr to /dev/null to avoid
showing errors to the user

2. pass "--quiet" to rev-list

Item (1) is obviously useful. But item (2) is
surprisingly not. For rev-list, "--quiet" does not have
anything to do with chattiness on stderr; it tells rev-list
not to bother writing the list of traversed objects to
stdout, for efficiency. And since we always redirect
rev-list's stdout to /dev/null in this function, there is no
point in asking it to ever write anything to stdout.

The efficiency gains are modest; a best-of-five run of "git
rev-list --objects --all" on linux.git dropped from 32.013s
to 30.502s when adding "--quiet". That's only about 5%, but
given how easy it is, it's worth doing.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
connected.c
index bf1b12e7ecaf476304811cabc870d58fc7f3f1dd..7560a31628115eafa40237f51f6c00e5b15b183c 100644 (file)
@@ -56,8 +56,7 @@ static int check_everything_connected_real(sha1_iterate_fn fn,
        argv[ac++] = "--stdin";
        argv[ac++] = "--not";
        argv[ac++] = "--all";
-       if (quiet)
-               argv[ac++] = "--quiet";
+       argv[ac++] = "--quiet";
        argv[ac] = NULL;
 
        rev_list.argv = argv;