mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Make git cache delete a defunct directory instead of moving it
So the original intention of moving it to a different directory to be deleted later was to (1) save it for diagnosis (2) be a single inode swap rather than a long rmtree delete. 1. No one is actually looking at these directories 2. The tmpdir sometimes end up on a different partition, so it ends up being a copy + delete instead. Since we're not getting timeouts from that, its probably actually better to just straight up delete it. BUG=410727 Review URL: https://codereview.chromium.org/538993002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291818 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
10
git_cache.py
10
git_cache.py
@@ -14,7 +14,6 @@ import re
|
||||
import tempfile
|
||||
import threading
|
||||
import time
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import urlparse
|
||||
@@ -344,14 +343,7 @@ class Mirror(object):
|
||||
bootstrapped = not depth and bootstrap and self.bootstrap_repo(tempdir)
|
||||
if bootstrapped:
|
||||
# Bootstrap succeeded; delete previous cache, if any.
|
||||
try:
|
||||
# Try to move folder to tempdir if possible.
|
||||
defunct_dir = tempfile.mkdtemp()
|
||||
shutil.move(self.mirror_path, defunct_dir)
|
||||
self.print('Moved defunct directory for repository %s from %s to %s'
|
||||
% (self.url, self.mirror_path, defunct_dir))
|
||||
except Exception:
|
||||
gclient_utils.rmtree(self.mirror_path)
|
||||
gclient_utils.rmtree(self.mirror_path)
|
||||
elif not os.path.exists(config_file):
|
||||
# Bootstrap failed, no previous cache; start with a bare git dir.
|
||||
self.RunGit(['init', '--bare'], cwd=tempdir)
|
||||
|
||||
Reference in New Issue
Block a user