Re: Invoke "git gc --auto" from commit, merge, am and rebase.
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Sep 6, 2007, 02:39 UTC
- Message-ID
- <20070906023934.GI18160@spearce.org>
- In-Reply-To
- <7vmyw0hixs.fsf_-_@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
> 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.
...
Show 5 quoted lines
> git-am.sh | 2 ++ > git-commit.sh | 1 + > git-merge.sh | 1 + > git-rebase--interactive.sh | 2 ++ > 4 files changed, 6 insertions(+), 0 deletions(-)
...
Show 12 quoted lines
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index abc2b1c..8258b7a 100755
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -307,6 +307,8 @@ do_next () {
> rm -rf "$DOTEST" &&
> warn "Successfully rebased and updated $HEADNAME."
>
> + git gc --auto
> +
> exit
> }Why bother with git-rebase--interactive.sh? It calls two tools, git-cherry-pick (which calls git-commit) and git-commit to do its per-commit dirty work. So on every step of `git rebase -i` we are now running `git gc --auto`. No need to also run it at the end.
Note this is also true of `git rebase -m` as that uses the wonderful feature of `git commit -C $oldid` per commit to make the new commit.
-- Shawn.