Skip to content

Commit

Permalink
Use full name of the revision when checking dest-branch
Browse files Browse the repository at this point in the history
The manifest usually doesn't sepecify the revision with the full name
(e.g. refs/heads/REV).
However, when checking if the name of the merge branch, full name is
used on the merge branch.

The CL use full name of revision when comparing it with the merge
branch.

Bug: b/370919047
Test: repo upload on a project with `dest-branch` set
Change-Id: Ib6fa2f7246beb5bae0a26a70048a7ac03b6c5a2f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/438401
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Tested-by: Joe Hsu <joehsu@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
  • Loading branch information
joehsu authored and LUCI committed Oct 28, 2024
1 parent ebdf040 commit f9f4df6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions subcmds/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,19 +603,22 @@ def _ExpandCommaList(value):
full_dest = destination
if not full_dest.startswith(R_HEADS):
full_dest = R_HEADS + full_dest
full_revision = branch.project.revisionExpr
if not full_revision.startswith(R_HEADS):
full_revision = R_HEADS + full_revision

# If the merge branch of the local branch is different from
# the project's revision AND destination, this might not be
# intentional.
if (
merge_branch
and merge_branch != branch.project.revisionExpr
and merge_branch != full_revision
and merge_branch != full_dest
):
print(
f"For local branch {branch.name}: merge branch "
f"{merge_branch} does not match destination branch "
f"{destination}"
f"{destination} and revision {branch.project.revisionExpr}"
)
print("skipping upload.")
print(
Expand Down

0 comments on commit f9f4df6

Please sign in to comment.