]> git.ipfire.org Git - thirdparty/git.git/commitdiff
auto-gc: pass --quiet down from am, commit, merge and rebase
authorJunio C Hamano <gitster@pobox.com>
Wed, 6 May 2020 20:18:30 +0000 (13:18 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 May 2020 19:24:35 +0000 (12:24 -0700)
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>
builtin/am.c
builtin/commit.c
builtin/merge.c
builtin/rebase.c

index e3dfd93c258f6930ac36fa42c6fd9b8c80045576..69e50de018ba01cb2243221f1c7b5d7617afc72d 100644 (file)
@@ -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 @@ next:
        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);
        }
 }
 
index 7ba33a3bec48de4b8a7b6433df1205bde9e3ebfa..fa8eca623ee9c0a0881f2a9597b032a620c73b2e 100644 (file)
@@ -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);
index d127d2225f897f111124fb55b12cd1aae7db7a8e..c66b9b532cb88371a1f28ed95de8002fb2bf0089 100644 (file)
@@ -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) {
index bff53d5d167e8501d7f501046ddb35daf0f2cd17..fe1a9aba4560b60bd1c4ee05ff15f024ccfbe272 100644 (file)
@@ -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;