summaryrefslogtreecommitdiff
path: root/lib/spack
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-08-12 23:59:13 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2015-08-12 23:59:13 -0700
commit6f75f5bd6a3d4c07416b3c3c704882432204dbb0 (patch)
tree0388ece5f6790c1f9330a92d1d4af91cf50b0c1b /lib/spack
parentf34b04e55536c8907ccaffff193e26e64aa61412 (diff)
parent9174c06598609241c1e6d66785e7aaeeb91e98a2 (diff)
downloadspack-6f75f5bd6a3d4c07416b3c3c704882432204dbb0.tar.gz
spack-6f75f5bd6a3d4c07416b3c3c704882432204dbb0.tar.bz2
spack-6f75f5bd6a3d4c07416b3c3c704882432204dbb0.tar.xz
spack-6f75f5bd6a3d4c07416b3c3c704882432204dbb0.zip
Merge pull request #88 from trws/git_depth_attempt
adding a fallback on failure with git --depth
Diffstat (limited to 'lib/spack')
-rw-r--r--lib/spack/spack/fetch_strategy.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index 0ba0251caa..b810023c5a 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -425,12 +425,21 @@ class GitFetchStrategy(VCSFetchStrategy):
if self.git_version > ver('1.7.10'):
args.append('--single-branch')
+ cloned = False
# Yet more efficiency, only download a 1-commit deep tree
if self.git_version >= ver('1.7.1'):
- args.extend(['--depth','1'])
+ try:
+ self.git(*(args + ['--depth','1', self.url]))
+ cloned = True
+ except spack.error.SpackError:
+ # This will fail with the dumb HTTP transport
+ # continue and try without depth, cleanup first
+ pass
+
+ if not cloned:
+ args.append(self.url)
+ self.git(*args)
- args.append(self.url)
- self.git(*args)
self.stage.chdir_to_source()
# For tags, be conservative and check them out AFTER