Merge pull request #88 from trws/git_depth_attempt

adding a fallback on failure with git --depth
This commit is contained in:
Todd Gamblin 2015-08-12 23:59:13 -07:00
commit 6f75f5bd6a

View File

@ -425,12 +425,21 @@ def fetch(self):
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