diff --git a/git_cache.py b/git_cache.py index a7ac8a775..bd534d085 100755 --- a/git_cache.py +++ b/git_cache.py @@ -607,9 +607,6 @@ class Mirror(object): # The folder is gen_number = subprocess.check_output( [self.git_exe, 'number', 'master'], cwd=self.mirror_path).strip() - # Run Garbage Collect to compress packfile. - self.RunGit(['gc', '--prune=all']) - gsutil = Gsutil(path=self.gsutil_exe, boto_path=None) src_name = self.mirror_path @@ -631,6 +628,9 @@ class Mirror(object): print('Cache %s already exists' % dest_name) return + # Run Garbage Collect to compress packfile. + self.RunGit(['gc', '--prune=all']) + gsutil.call('-m', 'cp', '-r', src_name, dest_name) #TODO(karenqian): prune old caches