diff options
author | 2018-02-06 06:33:29 -0500 | |
---|---|---|
committer | 2018-02-06 06:41:57 -0500 | |
commit | 732c2e65b8af57bcfaa99d5a4a741e6e2b616b14 (patch) | |
tree | 47bd9be3f91f41e6f48c447c8f8a8198c14481b9 | |
parent | grs/Synchronize.py: add git submodules support (diff) | |
download | grss-732c2e65b8af57bcfaa99d5a4a741e6e2b616b14.tar.gz grss-732c2e65b8af57bcfaa99d5a4a741e6e2b616b14.tar.bz2 grss-732c2e65b8af57bcfaa99d5a4a741e6e2b616b14.zip |
grs/Synchronize.py: always re-init submodules
-rw-r--r-- | grs/Synchronize.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/grs/Synchronize.py b/grs/Synchronize.py index 199928b..8a55c84 100644 --- a/grs/Synchronize.py +++ b/grs/Synchronize.py @@ -30,9 +30,6 @@ class Synchronize(): self.logfile = logfile def sync(self): - # If there is a .gitmodules, then update the submodules - git_modulesfile = os.path.join(self.local_repo, '.gitmodules') - if self.isgitdir(): # If the local repo exists, then make it pristine an pull cmd = 'git -C %s reset HEAD --hard' % self.local_repo @@ -41,18 +38,20 @@ class Synchronize(): Execute(cmd, timeout=60, logfile=self.logfile) cmd = 'git -C %s pull' % self.local_repo Execute(cmd, timeout=60, logfile=self.logfile) - if os.path.isfile(git_modulesfile): - cmd = 'git -C %s submodule update' % self.local_repo - Execute(cmd, timeout=60, logfile=self.logfile) else: # else clone afresh. cmd = 'git clone %s %s' % (self.remote_repo, self.local_repo) Execute(cmd, timeout=60, logfile=self.logfile) - if os.path.isfile(git_modulesfile): - cmd = 'git -C %s submodule init' % self.local_repo - Execute(cmd, timeout=60, logfile=self.logfile) - cmd = 'git -C %s submodule update' % self.local_repo - Execute(cmd, timeout=60, logfile=self.logfile) + + # If there is a .gitmodules, then init/update the submodules + git_modulesfile = os.path.join(self.local_repo, '.gitmodules') + if os.path.isfile(git_modulesfile): + # This may re-init submodules, but its harmless. We need + # to keep trying for newly added modules. + cmd = 'git -C %s submodule init' % self.local_repo + Execute(cmd, timeout=60, logfile=self.logfile) + cmd = 'git -C %s submodule update' % self.local_repo + Execute(cmd, timeout=60, logfile=self.logfile) # Make sure we're on the correct branch for the desired GRS system. cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch) |