All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 2/2] auto-gc: pass --quiet down from am, commit, merge and rebase
Date: Wed,  6 May 2020 13:18:30 -0700	[thread overview]
Message-ID: <20200506201830.92818-3-gitster@pobox.com> (raw)
In-Reply-To: <20200506201830.92818-1-gitster@pobox.com>

These commands take the --quiet option for their own operation, but
they forget to pass the option down when they invoke "git gc --auto"
internally.

Teach them to do so using the run_auto_gc() helper we added in the
previous step.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin/am.c     | 3 +--
 builtin/commit.c | 3 +--
 builtin/merge.c  | 3 +--
 builtin/rebase.c | 3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/builtin/am.c b/builtin/am.c
index e3dfd93c25..69e50de018 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1691,7 +1691,6 @@ static int do_interactive(struct am_state *state)
  */
 static void am_run(struct am_state *state, int resume)
 {
-	const char *argv_gc_auto[] = {"gc", "--auto", NULL};
 	struct strbuf sb = STRBUF_INIT;
 
 	unlink(am_path(state, "dirtyindex"));
@@ -1796,7 +1795,7 @@ static void am_run(struct am_state *state, int resume)
 	if (!state->rebasing) {
 		am_destroy(state);
 		close_object_store(the_repository->objects);
-		run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
+		run_auto_gc(state->quiet);
 	}
 }
 
diff --git a/builtin/commit.c b/builtin/commit.c
index 7ba33a3bec..fa8eca623e 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1488,7 +1488,6 @@ 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};
 	static struct wt_status s;
 	static struct option builtin_commit_options[] = {
 		OPT__QUIET(&quiet, N_("suppress summary after successful commit")),
@@ -1697,7 +1696,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 		return 1;
 
 	repo_rerere(the_repository, 0);
-	run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
+	run_auto_gc(quiet);
 	run_commit_hook(use_editor, get_index_file(), "post-commit", NULL);
 	if (amend && !no_post_rewrite) {
 		commit_post_rewrite(the_repository, current_head, &oid);
diff --git a/builtin/merge.c b/builtin/merge.c
index d127d2225f..c66b9b532c 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -447,7 +447,6 @@ static void finish(struct commit *head_commit,
 		if (verbosity >= 0 && !merge_msg.len)
 			printf(_("No merge message -- not updating HEAD\n"));
 		else {
-			const char *argv_gc_auto[] = { "gc", "--auto", NULL };
 			update_ref(reflog_message.buf, "HEAD", new_head, head,
 				   0, UPDATE_REFS_DIE_ON_ERR);
 			/*
@@ -455,7 +454,7 @@ static void finish(struct commit *head_commit,
 			 * user should see them.
 			 */
 			close_object_store(the_repository->objects);
-			run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
+			run_auto_gc(verbosity < 0);
 		}
 	}
 	if (new_head && show_diffstat) {
diff --git a/builtin/rebase.c b/builtin/rebase.c
index bff53d5d16..fe1a9aba45 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -763,7 +763,6 @@ static int apply_autostash(struct rebase_options *opts)
 static int finish_rebase(struct rebase_options *opts)
 {
 	struct strbuf dir = STRBUF_INIT;
-	const char *argv_gc_auto[] = { "gc", "--auto", NULL };
 	int ret = 0;
 
 	delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
@@ -773,7 +772,7 @@ static int finish_rebase(struct rebase_options *opts)
 	 * We ignore errors in 'gc --auto', since the
 	 * user should see them.
 	 */
-	run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
+	run_auto_gc(!(opts->flags & (REBASE_NO_QUIET|REBASE_VERBOSE)));
 	if (opts->type == REBASE_MERGE) {
 		struct replay_opts replay = REPLAY_OPTS_INIT;
 
-- 
2.26.2-561-g07d8ea56f2


  parent reply	other threads:[~2020-05-06 20:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06  9:43 option -q not passed from "git commit" to "git gc --auto" Pierrick Gaudry
2020-05-06 17:28 ` Taylor Blau
2020-05-06 17:33   ` Taylor Blau
2020-05-06 17:38     ` Taylor Blau
2020-05-06 17:31 ` Junio C Hamano
2020-05-06 18:56   ` Re* " Junio C Hamano
2020-05-06 19:03     ` [PATCH 2/2] auto-gc: pass --quiet down from am, commit, merge and rebase Junio C Hamano
2020-05-06 19:27       ` Junio C Hamano
2020-05-06 20:18 ` [PATCH 0/2] Pass down "--quiet" to "gc --auto" Junio C Hamano
2020-05-06 20:18   ` [PATCH 1/2] auto-gc: extract a reusable helper from "git fetch" Junio C Hamano
2020-05-06 20:18   ` Junio C Hamano [this message]
2020-05-07 17:22     ` [PATCH 2/2] auto-gc: pass --quiet down from am, commit, merge and rebase Taylor Blau
2020-05-07 19:31       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200506201830.92818-3-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.