auto-gc: pass --quiet down from am, commit, merge and rebase
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> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
May 6, 2020 at 13:18 UTC
7c3e9e8cfbf6a8e45f4745049dc58f5c9e9d1eb9
4 files changed
+4
-8
builtin/am.c
+1
-2
@@ -1691,7 +1691,6 @@ static int do_interactive(struct am_state *state)
1691
*/
1692
static void am_run(struct am_state *state, int resume)
1693
{
1694
- const char *argv_gc_auto[] = {"gc", "--auto", NULL};
1694
struct strbuf sb = STRBUF_INIT;
1695
1696
unlink(am_path(state, "dirtyindex"));
@@ -1796,7 +1795,7 @@ next:
1795
if (!state->rebasing) {
1796
am_destroy(state);
1797
close_object_store(the_repository->objects);
1799
- run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
1798
+ run_auto_gc(state->quiet);
1799
}
1800
}
1801
builtin/commit.c
+1
-2
@@ -1488,7 +1488,6 @@ static int git_commit_config(const char *k, const char *v, void *cb)
1488
1489
int cmd_commit(int argc, const char **argv, const char *prefix)
1490
{
1491
- const char *argv_gc_auto[] = {"gc", "--auto", NULL};
1491
static struct wt_status s;
1492
static struct option builtin_commit_options[] = {
1493
OPT__QUIET(&quiet, N_("suppress summary after successful commit")),
@@ -1697,7 +1696,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1696
return 1;
1697
1698
repo_rerere(the_repository, 0);
1700
- run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
1699
+ run_auto_gc(quiet);
1700
run_commit_hook(use_editor, get_index_file(), "post-commit", NULL);
1701
if (amend && !no_post_rewrite) {
1702
commit_post_rewrite(the_repository, current_head, &oid);
builtin/merge.c
+1
-2
@@ -447,7 +447,6 @@ static void finish(struct commit *head_commit,
447
if (verbosity >= 0 && !merge_msg.len)
448
printf(_("No merge message -- not updating HEAD\n"));
449
else {
450
- const char *argv_gc_auto[] = { "gc", "--auto", NULL };
450
update_ref(reflog_message.buf, "HEAD", new_head, head,
451
0, UPDATE_REFS_DIE_ON_ERR);
452
/*
@@ -455,7 +454,7 @@ static void finish(struct commit *head_commit,
454
* user should see them.
455
*/
456
close_object_store(the_repository->objects);
458
- run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
457
+ run_auto_gc(verbosity < 0);
458
}
459
}
460
if (new_head && show_diffstat) {
builtin/rebase.c
+1
-2
@@ -763,7 +763,6 @@ static int apply_autostash(struct rebase_options *opts)
763
static int finish_rebase(struct rebase_options *opts)
764
{
765
struct strbuf dir = STRBUF_INIT;
766
- const char *argv_gc_auto[] = { "gc", "--auto", NULL };
766
int ret = 0;
767
768
delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
@@ -773,7 +772,7 @@ static int finish_rebase(struct rebase_options *opts)
772
* We ignore errors in 'gc --auto', since the
773
* user should see them.
774
*/
776
- run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
775
+ run_auto_gc(!(opts->flags & (REBASE_NO_QUIET|REBASE_VERBOSE)));
776
if (opts->type == REBASE_MERGE) {
777
struct replay_opts replay = REPLAY_OPTS_INIT;
778