]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ab/gc-auto-in-commit'
authorJunio C Hamano <gitster@pobox.com>
Thu, 8 Mar 2018 20:36:30 +0000 (12:36 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Mar 2018 20:36:30 +0000 (12:36 -0800)
"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

1  2 
builtin/commit.c

index c14f95dbf6b11826f11e728354e6c7107878a07a,3a28a2ac61c498f9162c9bf43f4dc8d83a8ab1c0..092077c3eef7a81b3d814cee951cee98e37eac02
@@@ -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, &current_head->object.oid, &oid);
 -                      finish_copy_notes_for_rewrite(cfg, "Notes added by 'git commit --amend'");
 -              }
 -              run_rewrite_hook(&current_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);