summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGavin Mak <gavinmak@google.com>2025-06-17 12:06:03 -0700
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2025-06-17 13:31:02 -0700
commitf91f4462e6365b5545b39be597dab23619b8d291 (patch)
tree560339e729ec8e99781934888ad80e2059413e2c
parent85352825ff3903fe17bad05476284930dbf12fd8 (diff)
downloadgit-repo-f91f4462e6365b5545b39be597dab23619b8d291.tar.gz
upload: fix FileNotFoundError when no superproject
Upload gets a FileNotFoundError if not using superproject because it tries to access the superproject's repo_id before checking if superproject was actually enabled. Reorder the logic to check use_superproject first. Change-Id: I65cd2adab481e799dd7bb75e1a83553ad6e34d8d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/484401 Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
-rw-r--r--subcmds/upload.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py
index 169a8b77..4f817ddf 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -627,9 +627,12 @@ Gerrit Code Review: https://www.gerritcodereview.com/
627 # If using superproject, add the root repo as a push option. 627 # If using superproject, add the root repo as a push option.
628 manifest = branch.project.manifest 628 manifest = branch.project.manifest
629 push_options = list(opt.push_options) 629 push_options = list(opt.push_options)
630 sp = manifest.superproject 630 if manifest.manifestProject.use_superproject:
631 if sp and sp.repo_id and manifest.manifestProject.use_superproject: 631 sp = manifest.superproject
632 push_options.append(f"custom-keyed-value=rootRepo:{sp.repo_id}") 632 if sp:
633 r_id = sp.repo_id
634 if r_id:
635 push_options.append(f"custom-keyed-value=rootRepo:{r_id}")
633 636
634 branch.UploadForReview( 637 branch.UploadForReview(
635 people, 638 people,