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>
This commit is contained in:
LaMont Jones 2022-05-20 09:11:54 +00:00
parent 501733c2ab
commit 0ddb677611

View File

@ -3790,10 +3790,10 @@ class ManifestProject(MetaProject):
outer_manifest=False, outer_manifest=False,
) )
# Lastly, clone the superproject(s). # Lastly, if the manifest has a <superproject> then have the superproject
if self.manifest.manifestProject.use_superproject: # sync it if it will be used.
sync_result = Superproject( if self.manifest.superproject:
self.manifest, self.manifest.repodir, git_event_log, quiet=not verbose).Sync() sync_result = self.manifest.superproject.Sync(git_event_log)
if not sync_result.success: if not sync_result.success:
print('warning: git update of superproject for ' print('warning: git update of superproject for '
f'{self.manifest.path_prefix} failed, repo sync will not use ' f'{self.manifest.path_prefix} failed, repo sync will not use '