* [PATCH] silence git gc --auto --quiet output
@ 2012-09-24 2:40 Tobias Ulmer
2012-09-24 18:36 ` Jeff King
2012-09-24 22:42 ` Junio C Hamano
0 siblings, 2 replies; 4+ messages in thread
From: Tobias Ulmer @ 2012-09-24 2:40 UTC (permalink / raw)
To: git; +Cc: gitster
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 "
--
1.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] silence git gc --auto --quiet output
2012-09-24 2:40 [PATCH] silence git gc --auto --quiet output Tobias Ulmer
@ 2012-09-24 18:36 ` Jeff King
2012-09-24 22:42 ` Junio C Hamano
1 sibling, 0 replies; 4+ messages in thread
From: Jeff King @ 2012-09-24 18:36 UTC (permalink / raw)
To: Tobias Ulmer; +Cc: git, gitster
On Mon, Sep 24, 2012 at 04:40:24AM +0200, Tobias Ulmer wrote:
> When --quiet is requested, gc --auto should not display messages unless
> there is an error.
> [...]
> - 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] silence git gc --auto --quiet output
2012-09-24 2:40 [PATCH] silence git gc --auto --quiet output Tobias Ulmer
2012-09-24 18:36 ` Jeff King
@ 2012-09-24 22:42 ` Junio C Hamano
2012-09-24 22:53 ` Junio C Hamano
1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2012-09-24 22:42 UTC (permalink / raw)
To: Tobias Ulmer; +Cc: git
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] silence git gc --auto --quiet output
2012-09-24 22:42 ` Junio C Hamano
@ 2012-09-24 22:53 ` Junio C Hamano
0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2012-09-24 22:53 UTC (permalink / raw)
To: Tobias Ulmer; +Cc: git
Junio C Hamano <gitster@pobox.com> writes:
> 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
'
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-24 22:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-24 2:40 [PATCH] silence git gc --auto --quiet output Tobias Ulmer
2012-09-24 18:36 ` Jeff King
2012-09-24 22:42 ` Junio C Hamano
2012-09-24 22:53 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).