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 <sop@google.com>
This commit is contained in:
Shawn O. Pearce 2009-07-03 15:22:49 -07:00
parent 446c4e5556
commit 1875ddd47c
2 changed files with 3 additions and 0 deletions

View File

@ -55,6 +55,7 @@ need to be performed by an end-user.
print >>sys.stderr, "error: can't update repo" print >>sys.stderr, "error: can't update repo"
sys.exit(1) sys.exit(1)
rp.bare_git.gc('--auto')
_PostRepoFetch(rp, _PostRepoFetch(rp,
no_repo_verify = opt.no_repo_verify, no_repo_verify = opt.no_repo_verify,
verbose = True) verbose = True)

View File

@ -118,6 +118,8 @@ later is required to fix a server side protocol bug.
print >>sys.stderr, 'error: Cannot fetch %s' % project.name print >>sys.stderr, 'error: Cannot fetch %s' % project.name
sys.exit(1) sys.exit(1)
pm.end() pm.end()
for project in projects:
project.bare_git.gc('--auto')
return fetched return fetched
def UpdateProjectList(self): def UpdateProjectList(self):