summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-07-03 15:22:49 -0700
committerShawn O. Pearce <sop@google.com>2009-07-03 16:39:19 -0700
commit1875ddd47c0bf38e5cc52e1e5875caabce2d8742 (patch)
treecfa269cd610a1e569cd3b3b5e0d3a92675d74a7d
parent446c4e5556a4c85621d61b3aba63d084300c6224 (diff)
downloadgit-repo-1875ddd47c0bf38e5cc52e1e5875caabce2d8742.tar.gz
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>
-rw-r--r--subcmds/selfupdate.py1
-rw-r--r--subcmds/sync.py2
2 files changed, 3 insertions, 0 deletions
diff --git a/subcmds/selfupdate.py b/subcmds/selfupdate.py
index 4f46a129..46aa3a19 100644
--- a/subcmds/selfupdate.py
+++ b/subcmds/selfupdate.py
@@ -55,6 +55,7 @@ need to be performed by an end-user.
55 print >>sys.stderr, "error: can't update repo" 55 print >>sys.stderr, "error: can't update repo"
56 sys.exit(1) 56 sys.exit(1)
57 57
58 rp.bare_git.gc('--auto')
58 _PostRepoFetch(rp, 59 _PostRepoFetch(rp,
59 no_repo_verify = opt.no_repo_verify, 60 no_repo_verify = opt.no_repo_verify,
60 verbose = True) 61 verbose = True)
diff --git a/subcmds/sync.py b/subcmds/sync.py
index afd44dab..1537c9a2 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -118,6 +118,8 @@ later is required to fix a server side protocol bug.
118 print >>sys.stderr, 'error: Cannot fetch %s' % project.name 118 print >>sys.stderr, 'error: Cannot fetch %s' % project.name
119 sys.exit(1) 119 sys.exit(1)
120 pm.end() 120 pm.end()
121 for project in projects:
122 project.bare_git.gc('--auto')
121 return fetched 123 return fetched
122 124
123 def UpdateProjectList(self): 125 def UpdateProjectList(self):