From d177609cb0283e41e23d4c19b94e17f42bdbdacb Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Wed, 19 May 2021 19:37:23 +0200 Subject: [PATCH] sync: Sync submodules correctly again Commit b4429439 (sync: refactor main fetch loop) broke syncing of submodules with sync-s="true". The first `repo sync` would just fetch the superrepo, while the second `repo sync` would fetch the submodules. This was due to the new _FetchMain() function not passing back the all_projects variable that it had modified. Change-Id: Ie8187cde7bb894e4e9a6b76c2aed83873d9f69a4 Signed-off-by: Peter Kjellerstedt Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/307065 Reviewed-by: Mike Frysinger --- subcmds/sync.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/subcmds/sync.py b/subcmds/sync.py index fb25c221..67d9c115 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -469,11 +469,14 @@ later is required to fix a server side protocol bug. Args: opt: Program options returned from optparse. See _Options(). args: Command line args used to filter out projects. - all_projects: List of all projects that should be checked out. + all_projects: List of all projects that should be fetched. err_event: Whether an error was hit while processing. manifest_name: Manifest file to be reloaded. load_local_manifests: Whether to load local manifests. ssh_proxy: SSH manager for clients & masters. + + Returns: + List of all projects that should be checked out. """ rp = self.manifest.repoProject @@ -520,6 +523,8 @@ later is required to fix a server side protocol bug. err_event.set() fetched.update(new_fetched) + return all_projects + def _CheckoutOne(self, detach_head, force_sync, project): """Checkout work tree for one project @@ -1006,8 +1011,9 @@ later is required to fix a server side protocol bug. with ssh.ProxyManager(manager) as ssh_proxy: # Initialize the socket dir once in the parent. ssh_proxy.sock() - self._FetchMain(opt, args, all_projects, err_event, manifest_name, - load_local_manifests, ssh_proxy) + all_projects = self._FetchMain(opt, args, all_projects, err_event, + manifest_name, load_local_manifests, + ssh_proxy) if opt.network_only: return