diff options
author | Tom Scogland <tscogland@llnl.gov> | 2015-06-13 15:23:32 -0700 |
---|---|---|
committer | Thomas R. W. Scogland <scogland@llnl.gov> | 2015-06-13 15:29:55 -0700 |
commit | 0b5ca2535885812d110b7868ea6ef18a47ca7c5f (patch) | |
tree | c2c7b7900178fc6d8782ca1353dd81140f1a1146 | |
parent | 277df086769a279064bf36740d29bcdb22a562e4 (diff) | |
download | spack-0b5ca2535885812d110b7868ea6ef18a47ca7c5f.tar.gz spack-0b5ca2535885812d110b7868ea6ef18a47ca7c5f.tar.bz2 spack-0b5ca2535885812d110b7868ea6ef18a47ca7c5f.tar.xz spack-0b5ca2535885812d110b7868ea6ef18a47ca7c5f.zip |
Fix for repos with many tags
Ensures all tags are ready before checkout, using `--branch` if possible and
an extra pull if that is not available. Also adds `--depth 1` to create
shallow clones if the git version is sufficient.
Fixes #64.
-rw-r--r-- | lib/spack/spack/fetch_strategy.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index e46ec74e09..3e6f59d9b8 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -417,12 +417,18 @@ class GitFetchStrategy(VCSFetchStrategy): # If we want a particular branch ask for it. if self.branch: args.extend(['--branch', self.branch]) + elif self.tag and self.git_version >= ver('1.8.5.2'): + args.extend(['--branch', self.tag]) # Try to be efficient if we're using a new enough git. # This checks out only one branch's history if self.git_version > ver('1.7.10'): args.append('--single-branch') + # Yet more efficiency, only download a 1-commit deep tree + if self.git_version >= ver('1.7.1'): + args.extend(['--depth','1']) + args.append(self.url) self.git(*args) self.stage.chdir_to_source() @@ -430,7 +436,8 @@ class GitFetchStrategy(VCSFetchStrategy): # 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: + if self.tag and self.git_version < ver('1.8.5.2'): + self.git('pull', '--tags') self.git('checkout', self.tag) |