From 4ff530c56f607f049c0335d4e3e153f9ecbae990 Mon Sep 17 00:00:00 2001 From: Mihail Stoyanov Date: Thu, 15 Mar 2018 21:20:15 +0000 Subject: [PATCH] Check whether the cached repo scm matches the clone scm --- mbed/mbed.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mbed/mbed.py b/mbed/mbed.py index 4eb02d5e..5944d225 100644 --- a/mbed/mbed.py +++ b/mbed/mbed.py @@ -1192,7 +1192,7 @@ def clone(self, url, path, rev=None, depth=None, protocol=None, **kwargs): for _, scm in sorted_scms: main = True - cache = self.get_cache(url) + cache = self.get_cache(url, scm.name) # Try to clone with cache ref first if cache and not os.path.isdir(path): @@ -1275,9 +1275,9 @@ def rm_untracked(self): action("Remove untracked library reference \"%s\"" % f) os.remove(f) - def get_cache(self, url): + def get_cache(self, url, scm): up = urlparse(formaturl(url, 'https')) - if self.cache and up and up.netloc and os.path.isdir(os.path.join(self.cache, up.netloc, re.sub(r'^/', '', up.path))): + if self.cache and up and up.netloc and os.path.isdir(os.path.join(self.cache, up.netloc, re.sub(r'^/', '', up.path), '.'+scm)): return os.path.join(self.cache, up.netloc, re.sub(r'^/', '', up.path)) def set_cache(self, url):