gclient: Only _DeleteOrMove if the destination directory is non-empty
BUG=364601
Review URL: https://codereview.chromium.org/246433005
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@265298 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_scm.py b/gclient_scm.py
index 89647ac..b5a09a2 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -352,7 +352,8 @@
(os.path.isdir(self.checkout_path) and
not os.path.exists(os.path.join(self.checkout_path, '.git')))):
if (os.path.isdir(self.checkout_path) and
- not os.path.exists(os.path.join(self.checkout_path, '.git'))):
+ not os.path.exists(os.path.join(self.checkout_path, '.git')) and
+ os.listdir(self.checkout_path)):
# This is a little hack to work around checkouts which are created
# using "gclient config --name ."
if not self.relpath == '.':