Message ID | 20230219-allow-remote-branches-as-base-v2-1-8db83bda1403@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | ez: allow remote-tracking branches as ENROLL_BASE | expand |
diff --git a/b4/ez.py b/b4/ez.py index daa1b4f..c3b0237 100644 --- a/b4/ez.py +++ b/b4/ez.py @@ -371,7 +371,7 @@ def start_new_series(cmdargs: argparse.Namespace) -> None: slug = re.sub(r'\W+', '-', branchname).strip('-').lower() enroll_base = cmdargs.enroll_base # Is it a branch? - gitargs = ['show-ref', '--heads', enroll_base] + gitargs = ['show-ref', f'refs/heads/{enroll_base}', f'refs/remotes/{enroll_base}'] lines = b4.git_get_command_lines(None, gitargs) if lines: try:
Since 83b185a (ez: support enrolling branches using tags, 2022-08-16), we use 'git show-ref --heads' to check if the argument given to '--enroll-base' is a branch, so that the alternate code path can be taken for tags. This means that since that commit, using a remote-tracking branch as argument to '--enroll-base' does not work well, because such branches are not shown by 'git show-ref --heads'. The code path for tags is taken instead, and this usually leads to a "Multiple branches contain object" error (since several local branches are often based on the same remote-tracking branch). Pass a fully-qualified ref 'refs/heads/<enroll_base>' as pattern to 'git show-ref', and also pass it a second second pattern 'refs/remotes/<enroll_base>' to allow both local and remote-tracking branches. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> --- b4/ez.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)