{"thread":{"id":"31631","subject":"[PATCH] silence git gc --auto --quiet output","startedAt":"2012-09-24T02:40:24Z","lastAt":"2012-09-24T22:53:55Z","messageCount":4,"participants":["Tobias Ulmer","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"199785","messageId":"20120924024024.GA12700@tin.tmux.org","threadId":"31631","inReplyTo":null,"subject":"[PATCH] silence git gc --auto --quiet output","fromName":"Tobias Ulmer","fromEmail":"tobiasu@tmux.org","sentAt":"2012-09-24T02:40:24Z","receivedAt":"2012-09-24T02:40:24Z","isPatch":true,"sender":{"key":"tobiasu@tmux.org","avatar":"https://avatars.githubusercontent.com/u/357723?v=4"},"body":"When --quiet is requested, gc --auto should not display messages unless\nthere is an error.\n\nSigned-off-by: Tobias Ulmer <tobiasu@tmux.org>\n---\n builtin/gc.c |    4 +---\n 1 files changed, 1 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 6d46608..6be6c8d 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -217,9 +217,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)\n \t\t */\n \t\tif (!need_to_gc())\n \t\t\treturn 0;\n-\t\tif (quiet)\n-\t\t\tfprintf(stderr, _(\"Auto packing the repository for optimum performance.\\n\"));\n-\t\telse\n+\t\tif (!quiet)\n \t\t\tfprintf(stderr,\n \t\t\t\t\t_(\"Auto packing the repository for optimum performance. You may also\\n\"\n \t\t\t\t\t\"run \\\"git gc\\\" manually. See \"\n-- \n1.7.6\n"},{"id":"199839","messageId":"20120924183641.GA15858@sigill.intra.peff.net","threadId":"31631","inReplyTo":"20120924024024.GA12700@tin.tmux.org","subject":"Re: [PATCH] silence git gc --auto --quiet output","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-09-24T18:36:41Z","receivedAt":"2012-09-24T18:36:41Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Sep 24, 2012 at 04:40:24AM +0200, Tobias Ulmer wrote:\n\n> When --quiet is requested, gc --auto should not display messages unless\n> there is an error.\n> [...]\n> -\t\tif (quiet)\n> -\t\t\tfprintf(stderr, _(\"Auto packing the repository for optimum performance.\\n\"));\n\nThat makes sense to me. I wonder if we should also be more careful about\npropagating quiet flags from the callers of \"gc --auto\". For example,\n\"git am -q\" will run \"git gc --auto\" without the quiet flag at the end,\npotentially producing unwanted output.\n\n-Peff\n"},{"id":"199864","messageId":"7v3927xcu1.fsf@alter.siamese.dyndns.org","threadId":"31631","inReplyTo":"20120924024024.GA12700@tin.tmux.org","subject":"Re: [PATCH] silence git gc --auto --quiet output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-24T22:42:14Z","receivedAt":"2012-09-24T22:42:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tobias Ulmer <tobiasu@tmux.org> writes:\n\n> When --quiet is requested, gc --auto should not display messages unless\n> there is an error.\n>\n> Signed-off-by: Tobias Ulmer <tobiasu@tmux.org>\n> ---\n>  builtin/gc.c |    4 +---\n>  1 files changed, 1 insertions(+), 3 deletions(-)\n>\n> diff --git a/builtin/gc.c b/builtin/gc.c\n> index 6d46608..6be6c8d 100644\n> --- a/builtin/gc.c\n> +++ b/builtin/gc.c\n> @@ -217,9 +217,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)\n>  \t\t */\n>  \t\tif (!need_to_gc())\n>  \t\t\treturn 0;\n> -\t\tif (quiet)\n> -\t\t\tfprintf(stderr, _(\"Auto packing the repository for optimum performance.\\n\"));\n> -\t\telse\n> +\t\tif (!quiet)\n>  \t\t\tfprintf(stderr,\n>  \t\t\t\t\t_(\"Auto packing the repository for optimum performance. You may also\\n\"\n>  \t\t\t\t\t\"run \\\"git gc\\\" manually. See \"\n\nThis patch will break t5400; the test needs to be updated in the\nsame patch to check auto-gc kicks in when it should in some other\nway.  The test currently _relies_ on this message to see the gc is\ntriggered.\n"},{"id":"199865","messageId":"7vy5jzvxq4.fsf@alter.siamese.dyndns.org","threadId":"31631","inReplyTo":"7v3927xcu1.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] silence git gc --auto --quiet output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-24T22:53:55Z","receivedAt":"2012-09-24T22:53:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Tobias Ulmer <tobiasu@tmux.org> writes:\n>\n>> When --quiet is requested, gc --auto should not display messages unless\n>> there is an error.\n>>\n>> Signed-off-by: Tobias Ulmer <tobiasu@tmux.org>\n>> ---\n>>  builtin/gc.c |    4 +---\n>>  1 files changed, 1 insertions(+), 3 deletions(-)\n>>\n>> diff --git a/builtin/gc.c b/builtin/gc.c\n>> index 6d46608..6be6c8d 100644\n>> --- a/builtin/gc.c\n>> +++ b/builtin/gc.c\n>> @@ -217,9 +217,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)\n>>  \t\t */\n>>  \t\tif (!need_to_gc())\n>>  \t\t\treturn 0;\n>> -\t\tif (quiet)\n>> -\t\t\tfprintf(stderr, _(\"Auto packing the repository for optimum performance.\\n\"));\n>> -\t\telse\n>> +\t\tif (!quiet)\n>>  \t\t\tfprintf(stderr,\n>>  \t\t\t\t\t_(\"Auto packing the repository for optimum performance. You may also\\n\"\n>>  \t\t\t\t\t\"run \\\"git gc\\\" manually. See \"\n>\n> This patch will break t5400; the test needs to be updated in the\n> same patch to check auto-gc kicks in when it should in some other\n> way.  The test currently _relies_ on this message to see the gc is\n> triggered.\n\nI suspect that the following may be sufficient.  The test prepares a\nstale garbage file in the repository an auto-gc is expected to\nhappen, and makes sure the garbage file is removed after the\noperation that expects to trigger an auto-gc.  The detection of the\nmessage is more or less superfluous.\n\n t/t5400-send-pack.sh | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git i/t/t5400-send-pack.sh w/t/t5400-send-pack.sh\nindex 250c720..78ab177 100755\n--- i/t/t5400-send-pack.sh\n+++ w/t/t5400-send-pack.sh\n@@ -174,8 +174,7 @@ test_expect_success 'receive-pack runs auto-gc in remote repo' '\n \t    cd parent &&\n \t    echo \"Even more text\" >>file.txt &&\n \t    git commit -a -m \"Third commit\" &&\n-\t    git send-pack ../child HEAD:refs/heads/test_auto_gc >output 2>&1 &&\n-\t    grep \"Auto packing the repository for optimum performance.\" output\n+\t    git send-pack ../child HEAD:refs/heads/test_auto_gc\n \t) &&\n \ttest ! -e child/.git/objects/tmp_test_object\n '\n"}]}