Skip to content

Commit 7c3e9e8

Browse files
committed
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 <[email protected]> Reviewed-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 850b6ed commit 7c3e9e8

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

builtin/am.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,6 @@ static int do_interactive(struct am_state *state)
16911691
*/
16921692
static void am_run(struct am_state *state, int resume)
16931693
{
1694-
const char *argv_gc_auto[] = {"gc", "--auto", NULL};
16951694
struct strbuf sb = STRBUF_INIT;
16961695

16971696
unlink(am_path(state, "dirtyindex"));
@@ -1796,7 +1795,7 @@ static void am_run(struct am_state *state, int resume)
17961795
if (!state->rebasing) {
17971796
am_destroy(state);
17981797
close_object_store(the_repository->objects);
1799-
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
1798+
run_auto_gc(state->quiet);
18001799
}
18011800
}
18021801

builtin/commit.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,6 @@ static int git_commit_config(const char *k, const char *v, void *cb)
14881488

14891489
int cmd_commit(int argc, const char **argv, const char *prefix)
14901490
{
1491-
const char *argv_gc_auto[] = {"gc", "--auto", NULL};
14921491
static struct wt_status s;
14931492
static struct option builtin_commit_options[] = {
14941493
OPT__QUIET(&quiet, N_("suppress summary after successful commit")),
@@ -1697,7 +1696,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
16971696
return 1;
16981697

16991698
repo_rerere(the_repository, 0);
1700-
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
1699+
run_auto_gc(quiet);
17011700
run_commit_hook(use_editor, get_index_file(), "post-commit", NULL);
17021701
if (amend && !no_post_rewrite) {
17031702
commit_post_rewrite(the_repository, current_head, &oid);

builtin/merge.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,15 +447,14 @@ static void finish(struct commit *head_commit,
447447
if (verbosity >= 0 && !merge_msg.len)
448448
printf(_("No merge message -- not updating HEAD\n"));
449449
else {
450-
const char *argv_gc_auto[] = { "gc", "--auto", NULL };
451450
update_ref(reflog_message.buf, "HEAD", new_head, head,
452451
0, UPDATE_REFS_DIE_ON_ERR);
453452
/*
454453
* We ignore errors in 'gc --auto', since the
455454
* user should see them.
456455
*/
457456
close_object_store(the_repository->objects);
458-
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
457+
run_auto_gc(verbosity < 0);
459458
}
460459
}
461460
if (new_head && show_diffstat) {

builtin/rebase.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,6 @@ static int apply_autostash(struct rebase_options *opts)
763763
static int finish_rebase(struct rebase_options *opts)
764764
{
765765
struct strbuf dir = STRBUF_INIT;
766-
const char *argv_gc_auto[] = { "gc", "--auto", NULL };
767766
int ret = 0;
768767

769768
delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
@@ -773,7 +772,7 @@ static int finish_rebase(struct rebase_options *opts)
773772
* We ignore errors in 'gc --auto', since the
774773
* user should see them.
775774
*/
776-
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
775+
run_auto_gc(!(opts->flags & (REBASE_NO_QUIET|REBASE_VERBOSE)));
777776
if (opts->type == REBASE_MERGE) {
778777
struct replay_opts replay = REPLAY_OPTS_INIT;
779778

0 commit comments

Comments
 (0)