Add submodules option for git fetching.

This commit is contained in:
Todd Gamblin 2016-07-11 11:56:36 -07:00
parent 255d05a9c1
commit 86b1b28906

View File

@ -366,8 +366,8 @@ def fetch(self):
try:
self.check()
except ChecksumError:
# Future fetchers will assume they don't need to download if the
# file remains
# Future fetchers will assume they don't need to
# download if the file remains
os.remove(self.archive_file)
raise
@ -517,6 +517,7 @@ def __init__(self, **kwargs):
super(GitFetchStrategy, self).__init__(
'git', 'tag', 'branch', 'commit', **forwarded_args)
self._git = None
self.submodules = kwargs.get('submodules', False)
@property
def git_version(self):
@ -595,6 +596,10 @@ def fetch(self):
self.git('pull', '--tags', ignore_errors=1)
self.git('checkout', self.tag)
# Init submodules if the user asked for them.
if self.submodules:
self.git('submodule', 'update', '--init')
def archive(self, destination):
super(GitFetchStrategy, self).archive(destination, exclude='.git')