From 873e6672e1ca87d3db86bf29d85b496a3e07a553 Mon Sep 17 00:00:00 2001 From: "szager@google.com" Date: Tue, 13 Mar 2012 18:53:36 +0000 Subject: [PATCH] If a subdir exists and is empty, go ahead and clone into it. This will make it easier to support git-submodule and gclient at the same time. Review URL: http://codereview.chromium.org/9692022 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@126428 0039d316-1c4b-4281-b951-d872f2087c98 --- gclient_scm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gclient_scm.py b/gclient_scm.py index 881b7f03a..e8c1711f8 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -219,7 +219,9 @@ class GitWrapper(SCMWrapper): # hash is also a tag, only make a distinction at checkout rev_type = "hash" - if not os.path.exists(self.checkout_path): + if not os.path.exists(self.checkout_path) or ( + os.path.isdir(self.checkout_path) and + not os.listdir(self.checkout_path)): gclient_utils.safe_makedirs(os.path.dirname(self.checkout_path)) self._Clone(revision, url, options) files = self._Capture(['ls-files']).splitlines()