summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-05-18 11:25:26 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2015-05-18 11:26:32 -0700
commitb2f46c703d172a395abac96508578186e36bb504 (patch)
tree4c4b3c6dad14128d1a300a32180c604377716928
parent76cb3eb7d2cea7343a51c578fdcec090890f5441 (diff)
downloadspack-b2f46c703d172a395abac96508578186e36bb504.tar.gz
spack-b2f46c703d172a395abac96508578186e36bb504.tar.bz2
spack-b2f46c703d172a395abac96508578186e36bb504.tar.xz
spack-b2f46c703d172a395abac96508578186e36bb504.zip
Fix SPACK-87: Tag checkout fails for older git versions.
-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')