git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] commit: silence git-gc if --quiet is given
@ 2020-05-06 14:01 Abhishek Kumar
  2020-05-06 16:09 ` Eric Sunshine
  0 siblings, 1 reply; 3+ messages in thread
From: Abhishek Kumar @ 2020-05-06 14:01 UTC (permalink / raw)
  To: git; +Cc: Pierrick Gaudry

As reported by Perrick [1], commit does not propagate quiet behavior to
gc if present. While we are at it, convert argv_gc_auto to struct argv_array.

[1]: https://lore.kernel.org/git/20200506094327.GC31637@rillettes/

Reported-by: Pierrick Gaudry <pierrick.gaudry@loria.fr>
Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
---
 builtin/commit.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index a73de0a4c5..a48e312ebd 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1494,7 +1494,7 @@ static int git_commit_config(const char *k, const char *v, void *cb)
 
 int cmd_commit(int argc, const char **argv, const char *prefix)
 {
-	const char *argv_gc_auto[] = {"gc", "--auto", NULL};
+	struct argv_array argv_gc_auto = ARGV_ARRAY_INIT;
 	static struct wt_status s;
 	static struct option builtin_commit_options[] = {
 		OPT__QUIET(&quiet, N_("suppress summary after successful commit")),
@@ -1703,7 +1703,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 	git_test_write_commit_graph_or_die();
 
 	repo_rerere(the_repository, 0);
-	run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
+	argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL);
+	if (quiet)
+		argv_array_push(&argv_gc_auto, "--quiet");
+	run_command_v_opt(argv_gc_auto.argv, RUN_GIT_CMD);
+	argv_array_clear(&argv_gc_auto);
 	run_commit_hook(use_editor, get_index_file(), "post-commit", NULL);
 	if (amend && !no_post_rewrite) {
 		commit_post_rewrite(the_repository, current_head, &oid);
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] commit: silence git-gc if --quiet is given
  2020-05-06 14:01 [PATCH] commit: silence git-gc if --quiet is given Abhishek Kumar
@ 2020-05-06 16:09 ` Eric Sunshine
  2020-05-06 17:33   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sunshine @ 2020-05-06 16:09 UTC (permalink / raw)
  To: Abhishek Kumar; +Cc: Git List, Pierrick Gaudry

On Wed, May 6, 2020 at 10:03 AM Abhishek Kumar
<abhishekkumar8222@gmail.com> wrote:
> As reported by Perrick [1], commit does not propagate quiet behavior to
> gc if present. While we are at it, convert argv_gc_auto to struct argv_array.
>
> [1]: https://lore.kernel.org/git/20200506094327.GC31637@rillettes/

According to the source you cite, this sort of issue has come up
before in a different context (git-fetch). Do we know if there are
other commands which invoke git-gc which might also suffer the same
issue? It would be nice for the commit message to say something about
this... for instance, that git-commit is the final command which needs
this fix or, if not, which additional commands are likely to need the
same treatment.

> Reported-by: Pierrick Gaudry <pierrick.gaudry@loria.fr>
> Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] commit: silence git-gc if --quiet is given
  2020-05-06 16:09 ` Eric Sunshine
@ 2020-05-06 17:33   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2020-05-06 17:33 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Abhishek Kumar, Git List, Pierrick Gaudry

Eric Sunshine <sunshine@sunshineco.com> writes:

> On Wed, May 6, 2020 at 10:03 AM Abhishek Kumar
> <abhishekkumar8222@gmail.com> wrote:
>> As reported by Perrick [1], commit does not propagate quiet behavior to
>> gc if present. While we are at it, convert argv_gc_auto to struct argv_array.
>>
>> [1]: https://lore.kernel.org/git/20200506094327.GC31637@rillettes/
>
> According to the source you cite, this sort of issue has come up
> before in a different context (git-fetch). Do we know if there are
> other commands which invoke git-gc which might also suffer the same
> issue?

I just wrote my analysis to the original thread.  It looks to me a
fairly low-hanging fruit.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-06 17:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 14:01 [PATCH] commit: silence git-gc if --quiet is given Abhishek Kumar
2020-05-06 16:09 ` Eric Sunshine
2020-05-06 17:33   ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).