summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/fetch_strategy.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index 48313e2b37..c892e9ea26 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -363,10 +363,6 @@ class GitFetchStrategy(VCSFetchStrategy):
'git', 'tag', 'branch', 'commit', **kwargs)
self._git = None
- # For git fetch branches and tags the same way.
- if not self.branch:
- self.branch = self.tag
-
@property
def git_version(self):
@@ -422,6 +418,12 @@ class GitFetchStrategy(VCSFetchStrategy):
self.git(*args)
self.stage.chdir_to_source()
+ # For tags, be conservative and check them out AFTER
+ # cloning. Later git versions can do this with clone
+ # --branch, but older ones fail.
+ if self.tag:
+ self.git('checkout', self.tag)
+
def archive(self, destination):
super(GitFetchStrategy, self).archive(destination, exclude='.git')