Index: gclient_scm.py |
diff --git a/gclient_scm.py b/gclient_scm.py |
index 4e3ab8264a81dd9de4ea246c02b18014354331e2..00f81bff571a53ca93de4dbcbe8fd92c936c7093 100644 |
--- a/gclient_scm.py |
+++ b/gclient_scm.py |
@@ -456,13 +456,44 @@ class GitWrapper(SCMWrapper): |
self._CheckClean(rev_str) |
# Switch over to the new upstream |
self._Run(['remote', 'set-url', self.remote, url], options) |
+ self.Print("remote is set", revision, self.url) |
if mirror: |
with open(os.path.join( |
self.checkout_path, '.git', 'objects', 'info', 'alternates'), |
'w') as fh: |
fh.write(os.path.join(url, 'objects')) |
+ try: |
Adrian Kuegel
2015/08/21 15:41:16
Just a small nit: couldn't you put these lines int
|
+ self._Capture(['rev-list', '-n', '1', 'HEAD']) |
+ except subprocess2.CalledProcessError as e: |
+ if ('fatal: bad object HEAD' in e.stderr |
+ and self.cache_dir and self.cache_dir in url): |
+ self.Print(( |
+ 'Likely due to DEPS change with git cache_dir, ' |
+ 'the current commit points to no longer existing object.\n' |
+ '%s' % e) |
+ ) |
+ self._DeleteOrMove(options.force) |
+ self._Clone(revision, url, options) |
+ else: |
+ raise |
self._FetchAndReset(revision, file_list, options) |
+ |
return_early = True |
+ else: |
+ try: |
+ self._Capture(['rev-list', '-n', '1', 'HEAD']) |
+ except subprocess2.CalledProcessError as e: |
+ if ('fatal: bad object HEAD' in e.stderr |
+ and self.cache_dir and self.cache_dir in url): |
+ self.Print(( |
+ 'Likely due to DEPS change with git cache_dir, ' |
+ 'the current commit points to no longer existing object.\n' |
+ '%s' % e) |
+ ) |
+ self._DeleteOrMove(options.force) |
+ self._Clone(revision, url, options) |
+ else: |
+ raise |
if return_early: |
return self._Capture(['rev-parse', '--verify', 'HEAD']) |