From: Junio C Hamano Date: Thu, 8 Mar 2018 20:36:30 +0000 (-0800) Subject: Merge branch 'ab/gc-auto-in-commit' X-Git-Tag: v2.17.0-rc0~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9bb8eb0c88d210d3575bd484320f9abfef551ed1;p=git Merge branch 'ab/gc-auto-in-commit' "git commit" used to run "gc --auto" near the end, which was lost when the command was reimplemented in C by mistake. * ab/gc-auto-in-commit: commit: run git gc --auto just before the post-commit hook --- 9bb8eb0c88d210d3575bd484320f9abfef551ed1 diff --cc builtin/commit.c index c14f95dbf6,3a28a2ac61..092077c3ee --- a/builtin/commit.c +++ b/builtin/commit.c @@@ -1614,19 -1836,20 +1615,20 @@@ int cmd_commit(int argc, const char **a "not exceeded, and then \"git reset HEAD\" to recover.")); rerere(0); + run_command_v_opt(argv_gc_auto, RUN_GIT_CMD); run_commit_hook(use_editor, get_index_file(), "post-commit", NULL); if (amend && !no_post_rewrite) { - struct notes_rewrite_cfg *cfg; - cfg = init_copy_notes_for_rewrite("amend"); - if (cfg) { - /* we are amending, so current_head is not NULL */ - copy_note_for_rewrite(cfg, ¤t_head->object.oid, &oid); - finish_copy_notes_for_rewrite(cfg, "Notes added by 'git commit --amend'"); - } - run_rewrite_hook(¤t_head->object.oid, &oid); + commit_post_rewrite(current_head, &oid); + } + if (!quiet) { + unsigned int flags = 0; + + if (!current_head) + flags |= SUMMARY_INITIAL_COMMIT; + if (author_date_is_interesting()) + flags |= SUMMARY_SHOW_AUTHOR_DATE; + print_commit_summary(prefix, &oid, flags); } - if (!quiet) - print_summary(prefix, &oid, !current_head); UNLEAK(err); UNLEAK(sb);