project: fix --use-superproject logic for init.
If init was run with --use-superproject, init failed.
If init was run without --{no,}use-superproject option then manifests
with <superproject/> elements were mishandled.
Bug: b/233226285
Test: manual
Change-Id: I737e71c89d2d7c324114f58bf2dc82b40e5beba7
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/337534
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: LaMont Jones <lamontjones@google.com>
diff --git a/project.py b/project.py
index 2641c44..9f79030 100644
--- a/project.py
+++ b/project.py
@@ -3790,10 +3790,10 @@
outer_manifest=False,
)
- # Lastly, clone the superproject(s).
- if self.manifest.manifestProject.use_superproject:
- sync_result = Superproject(
- self.manifest, self.manifest.repodir, git_event_log, quiet=not verbose).Sync()
+ # Lastly, if the manifest has a <superproject> then have the superproject
+ # sync it if it will be used.
+ if self.manifest.superproject:
+ sync_result = self.manifest.superproject.Sync(git_event_log)
if not sync_result.success:
print('warning: git update of superproject for '
f'{self.manifest.path_prefix} failed, repo sync will not use '