Browse files

sync: Run `git gc --auto` after fetch

Users may wind up with a lot of loose object content in projects they
don't frequently make changes in, but that are modified by others.

Since we bypass many git code paths that would have otherwise called
out to `git gc --auto`, its possible for these projects to have
their loose object database grow out of control.  To help prevent
that, we now invoke it ourselves during the network half of sync.

Signed-off-by: Shawn O. Pearce <>
(cherry picked from commit 1875ddd)
  • Loading branch information...
spearce committed Jul 3, 2009
1 parent 2bf9db0 commit 0d2b61f11d0501fcf1e5a1c19f18dac03e0b09bc
Showing with 3 additions and 0 deletions.
  1. +1 −0 subcmds/
  2. +2 −0 subcmds/
@@ -55,6 +55,7 @@ def Execute(self, opt, args):
print >>sys.stderr, "error: can't update repo"
+ rp.bare_git.gc('--auto')
no_repo_verify = opt.no_repo_verify,
verbose = True)
@@ -185,6 +185,8 @@ def _Fetch(self, projects, opt):
+ for project in projects:
+ project.bare_git.gc('--auto')
return fetched
def UpdateProjectList(self):

0 comments on commit 0d2b61f

Please sign in to comment.