Remove the old cache dir before moving the bootstrapped cache dir into the real location

Seems like some combination of things (bad cache dir, shallow checkout, etc) causes
git cache to not clean up properly before trying to move new directory A into
already existing directory B.

So the logic is all there to detect that the cache is invalid, its just not
being cleaned up properly during shallow checkouts.

BUG=406864
TBR=iannucci

Review URL: https://codereview.chromium.org/499123002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291587 0039d316-1c4b-4281-b951-d872f2087c98
changes/01/332501/1
hinoka@chromium.org 11 years ago
parent e75854552e
commit a5cda1e5db

@ -416,6 +416,8 @@ class Mirror(object):
finally:
if tempdir:
try:
if os.path.exists(self.mirror_path):
gclient_utils.rmtree(self.mirror_path)
os.rename(tempdir, self.mirror_path)
except OSError as e:
# This is somehow racy on Windows.

Loading…
Cancel
Save