mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Fix how we format the full destination branch when uploading.
If the dest-branch attribute is set in the project manifest, then we need to push to that branch. Previously, we would unconditionally pre-pend the refs/heads prefix to it. The dest-branch attribute is allowed to be a ref expression though, so it may already have it. Simple fix is to check if it already has the prefix before adding it. Bug: crbug.com/gerrit/12770 Change-Id: I45d6107ed6cf305cf223023b0ddad4278f7f4146 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/268152 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Sean McAllister <smcallis@google.com>
This commit is contained in:
parent
e7082ccb54
commit
682f0b6426
@ -23,6 +23,7 @@ from command import InteractiveCommand
|
||||
from editor import Editor
|
||||
from error import HookError, UploadError
|
||||
from git_command import GitCommand
|
||||
from git_refs import R_HEADS
|
||||
from project import RepoHook
|
||||
|
||||
from pyversion import is_python3
|
||||
@ -462,7 +463,10 @@ Gerrit Code Review: https://www.gerritcodereview.com/
|
||||
# Make sure our local branch is not setup to track a different remote branch
|
||||
merge_branch = self._GetMergeBranch(branch.project)
|
||||
if destination:
|
||||
full_dest = 'refs/heads/%s' % destination
|
||||
full_dest = destination
|
||||
if not full_dest.startswith(R_HEADS):
|
||||
full_dest = R_HEADS + full_dest
|
||||
|
||||
if not opt.dest_branch and merge_branch and merge_branch != full_dest:
|
||||
print('merge branch %s does not match destination branch %s'
|
||||
% (merge_branch, full_dest))
|
||||
|
Loading…
Reference in New Issue
Block a user