project: Do not exit early on --standalone-manifest.

After we successfully download the standalone manifest file, we cannot
exit early.

Bug: https://bugs.chromium.org/p/gerrit/issues/detail?id=15861
Change-Id: Ic47c9f7e9921851f94c6f24fd82b896eff524037
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/335974
Reviewed-by: Raman Tenneti <rtenneti@google.com>
Tested-by: LaMont Jones <lamontjones@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
LaMont Jones 2022-04-27 17:34:42 +00:00
parent 0de4fc3001
commit 0165e20fcc

View File

@ -3710,21 +3710,11 @@ class ManifestProject(MetaProject):
if use_superproject is not None: if use_superproject is not None:
self.config.SetBoolean('repo.superproject', use_superproject) self.config.SetBoolean('repo.superproject', use_superproject)
if standalone_manifest: if not standalone_manifest:
if is_new: if not self.Sync_NetworkHalf(
manifest_name = 'default.xml' is_new=is_new, quiet=not verbose, verbose=verbose,
manifest_data = fetch.fetch_file(manifest_url, verbose=verbose) clone_bundle=clone_bundle, current_branch_only=current_branch_only,
dest = os.path.join(self.worktree, manifest_name) tags=tags, submodules=submodules, clone_filter=clone_filter,
os.makedirs(os.path.dirname(dest), exist_ok=True)
with open(dest, 'wb') as f:
f.write(manifest_data)
return
if not self.Sync_NetworkHalf(is_new=is_new, quiet=not verbose, verbose=verbose,
clone_bundle=clone_bundle,
current_branch_only=current_branch_only,
tags=tags, submodules=submodules,
clone_filter=clone_filter,
partial_clone_exclude=self.manifest.PartialCloneExclude): partial_clone_exclude=self.manifest.PartialCloneExclude):
r = self.GetRemote(self.remote.name) r = self.GetRemote(self.remote.name)
print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr) print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr)
@ -3751,6 +3741,15 @@ class ManifestProject(MetaProject):
print('fatal: manifest name (-m) is required.', file=sys.stderr) print('fatal: manifest name (-m) is required.', file=sys.stderr)
return False return False
elif is_new:
# This is a new standalone manifest.
manifest_name = 'default.xml'
manifest_data = fetch.fetch_file(manifest_url, verbose=verbose)
dest = os.path.join(self.worktree, manifest_name)
os.makedirs(os.path.dirname(dest), exist_ok=True)
with open(dest, 'wb') as f:
f.write(manifest_data)
try: try:
self.manifest.Link(manifest_name) self.manifest.Link(manifest_name)
except ManifestParseError as e: except ManifestParseError as e: