git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] silence git gc --auto --quiet output

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 24, 2012, 22:53 UTC
Message-ID
<7vy5jzvxq4.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7v3927xcu1.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 30 quoted lines
> Tobias Ulmer <tobiasu@tmux.org> writes:
>
>> When --quiet is requested, gc --auto should not display messages unless
>> there is an error.
>>
>> Signed-off-by: Tobias Ulmer <tobiasu@tmux.org>
>> ---
>>  builtin/gc.c |    4 +---
>>  1 files changed, 1 insertions(+), 3 deletions(-)
>>
>> diff --git a/builtin/gc.c b/builtin/gc.c
>> index 6d46608..6be6c8d 100644
>> --- a/builtin/gc.c
>> +++ b/builtin/gc.c
>> @@ -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.

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(-)
diff --git i/t/t5400-send-pack.sh w/t/t5400-send-pack.sh
index 250c720..78ab177 100755
--- i/t/t5400-send-pack.sh
+++ w/t/t5400-send-pack.sh
@@ -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
 '
Previous: Junio C Hamano
Message 4 of 4 in “silence git gc --auto --quiet output”
  1. silence git gc --auto --quiet outputTobias Ulmer, Sep 24, 2012
  2. Jeff KingSep 24, 2012
  3. Junio C HamanoSep 24, 2012
  4. Junio C HamanoSep 24, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.