From 42f9adffd39b2e8737828ad063073410de0bf9a2 Mon Sep 17 00:00:00 2001 From: "hinoka@chromium.org" Date: Fri, 5 Sep 2014 11:10:35 +0000 Subject: [PATCH] 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 --- git_cache.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/git_cache.py b/git_cache.py index 21252535f..5d1af238e 100755 --- a/git_cache.py +++ b/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)