Chromium Code Reviews| Index: git_cache.py |
| diff --git a/git_cache.py b/git_cache.py |
| index 75fb29ac4a638cc87353e04b957a53f383bc7dc9..c7229062375619e0e3e7c13e34270195eae944e6 100755 |
| --- a/git_cache.py |
| +++ b/git_cache.py |
| @@ -310,7 +310,7 @@ class Mirror(object): |
| return os.path.isfile(os.path.join(self.mirror_path, 'config')) |
| def populate(self, depth=None, shallow=False, bootstrap=False, |
| - verbose=False, ignore_lock=False): |
| + verbose=False, ignore_lock=False, recurse=True): |
| assert self.GetCachePath() |
| if shallow and not depth: |
| depth = 10000 |
| @@ -374,6 +374,13 @@ class Mirror(object): |
| try: |
| self.RunGit(fetch_cmd + [spec], cwd=rundir, retry=True) |
| except subprocess.CalledProcessError: |
| + if spec == '+refs/heads/*:refs/heads/*': |
| + if not recurse: |
| + # We definitely want to fail if the main refspec fails to fetch. |
| + raise |
| + # The cache is corrupt, bootstrap it. |
| + os.remove(config_file) |
| + self.populate(depth, shallow, True, verbose, ignore_lock, False) |
|
szager1
2014/06/25 14:48:12
I would like this better if you split out the logi
|
| logging.warn('Fetch of %s failed' % spec) |
| if tempdir: |
| os.rename(tempdir, self.mirror_path) |