Skip to content

Commit d4bb43e

Browse files
committed
Invoke "git gc --auto" from commit, merge, am and rebase.
The point of auto gc is to pack new objects created in loose format, so a good rule of thumb is where we do update-ref after creating a new commit. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 2c3c439 commit d4bb43e

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

git-am.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,8 @@ do
466466
"$GIT_DIR"/hooks/post-applypatch
467467
fi
468468

469+
git gc --auto
470+
469471
go_next
470472
done
471473

git-commit.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ git rerere
652652

653653
if test "$ret" = 0
654654
then
655+
git gc --auto
655656
if test -x "$GIT_DIR"/hooks/post-commit
656657
then
657658
"$GIT_DIR"/hooks/post-commit

git-merge.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ finish () {
8282
;;
8383
*)
8484
git update-ref -m "$rlogm" HEAD "$1" "$head" || exit 1
85+
git gc --auto
8586
;;
8687
esac
8788
;;

git-rebase--interactive.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ do_next () {
307307
rm -rf "$DOTEST" &&
308308
warn "Successfully rebased and updated $HEADNAME."
309309

310+
git gc --auto
311+
310312
exit
311313
}
312314

0 commit comments

Comments
 (0)