From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B8B1E1382C5 for ; Tue, 6 Feb 2018 11:42:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B25A3E0A83; Tue, 6 Feb 2018 11:42:23 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 90781E0A83 for ; Tue, 6 Feb 2018 11:42:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4BAF7335C07 for ; Tue, 6 Feb 2018 11:42:22 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CA3831CE for ; Tue, 6 Feb 2018 11:42:20 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1517917317.732c2e65b8af57bcfaa99d5a4a741e6e2b616b14.blueness@gentoo> Subject: [gentoo-commits] proj/grss:master commit in: grs/ X-VCS-Repository: proj/grss X-VCS-Files: grs/Synchronize.py X-VCS-Directories: grs/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: 732c2e65b8af57bcfaa99d5a4a741e6e2b616b14 X-VCS-Branch: master Date: Tue, 6 Feb 2018 11:42:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 1ad46707-2482-4451-86a7-1287ce2d782a X-Archives-Hash: 2d2798d06312db387df79bbe1b0fd793 commit: 732c2e65b8af57bcfaa99d5a4a741e6e2b616b14 Author: Anthony G. Basile gentoo org> AuthorDate: Tue Feb 6 11:33:29 2018 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Tue Feb 6 11:41:57 2018 +0000 URL: https://gitweb.gentoo.org/proj/grss.git/commit/?id=732c2e65 grs/Synchronize.py: always re-init submodules grs/Synchronize.py | 21 ++++++++++----------- 1 file 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)