silence git gc --auto --quiet output
PATCH 1/1 silence git gc --auto --quiet output
When --quiet is requested, gc --auto should not display messages unless there is an error.
--- builtin/gc.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
builtin/gc.c +1 -3
@@ -217,9 +217,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)*/ if (!need_to_gc ())return 0 ; -if (quiet) -fprintf (stderr,_ ("Auto packing the repository for optimum performance.\n" )); -else +if (!quiet) fprintf(stderr, _("Auto packing the repository for optimum performance. You may also\n" "run \"git gc\" manually. See "
Signature · 1 line
1.7.6
builtin/gc.c int cmd_gc(int argc, const char **argv, const char *prefix) · line 221
Quoted 5 lines · Tobias Ulmer
When --quiet is requested, gc --auto should not display messages unless there is an error.
[...]builtin/gc.c +0
-2-if (quiet) -fprintf (stderr,_ ("Auto packing the repository for optimum performance.\n" ));
That makes sense to me. I wonder if we should also be more careful about propagating quiet flags from the callers of "gc --auto". For example, "git am -q" will run "git gc --auto" without the quiet flag at the end, potentially producing unwanted output.
-Peff
Quoted 13 lines · Tobias Ulmer
When --quiet is requested, gc --auto should not display messages unless there is an error.
Signed-off-by Tobias Ulmer <[email protected]>--- builtin/gc.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)builtin/gc.c +0
-0
builtin/gc.c int cmd_gc(int argc, const char **argv, const char *prefix) · line 223
Quoted 10 lines
builtin/gc.c +1
-3@@ -217,9 +217,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)*/ if (!need_to_gc ())return 0 ; -if (quiet) -fprintf (stderr,_ ("Auto packing the repository for optimum performance.\n" )); -else +if (!quiet) fprintf(stderr, _("Auto packing the repository for optimum performance. You may also\n" "run \"git gc\" manually. See "
This patch will break t5400; the test needs to be updated in the same patch to check auto-gc kicks in when it should in some other way. The test currently _relies_ on this message to see the gc is triggered.
Quoted 22 lines · Junio C Hamano
Quoted 20 lines · Tobias Ulmer
When --quiet is requested, gc --auto should not display messages unless there is an error.
Signed-off-by Tobias Ulmer <[email protected]>--- builtin/gc.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)builtin/gc.c +1
-3@@ -217,9 +217,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)*/ if (!need_to_gc ())return 0 ; -if (quiet) -fprintf (stderr,_ ("Auto packing the repository for optimum performance.\n" )); -else +if (!quiet)
Quoted 8 lines
builtin/gc.c int cmd_gc(int argc, const char **argv, const char *prefix) · line 223
Quoted 3 lines
builtin/gc.c +0
-0fprintf(stderr, _("Auto packing the repository for optimum performance. You may also\n" "run \"git gc\" manually. See "This patch will break t5400; the test needs to be updated in the same patch to check auto-gc kicks in when it should in some other way. The test currently _relies_ on this message to see the gc is triggered.
I suspect that the following may be sufficient. The test prepares a stale garbage file in the repository an auto-gc is expected to happen, and makes sure the garbage file is removed after the operation that expects to trigger an auto-gc. The detection of the message is more or less superfluous.
t/t5400-send-pack.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
t/t5400-send-pack.sh +1 -2
@@ -174,8 +174,7 @@ test_expect_success 'receive-pack runs auto-gc in remote repo' ' cd parent && echo "Even more text" >>file.txt && git commit -a -m "Third commit" && - git send-pack ../child HEAD:refs/heads/test_auto_gc >output 2>&1 && - grep "Auto packing the repository for optimum performance." output + git send-pack ../child HEAD:refs/heads/test_auto_gc ) && test ! -e child/.git/objects/tmp_test_object '