[PATCH] buildman: Support upstream branch name containing /

Tom Rini trini at konsulko.com
Mon Oct 30 18:37:44 CET 2023


On Mon, Oct 30, 2023 at 10:22:30AM -0700, Simon Glass wrote:

> Buildman assumes that branch names do not have a slash in them, since
> slash is used to delimit remotes, etc. This means that a branch called
> 'WIP/tryme' in remote dm ends up being 'tryme'.
> 
> Adjust the logic a little, to try to accommodate this.
> 
> For now, no tests are added for this behaviour.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
>  tools/patman/gitutil.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
> index b0a12f2e8c06..10ea5ff39f5c 100644
> --- a/tools/patman/gitutil.py
> +++ b/tools/patman/gitutil.py
> @@ -147,8 +147,9 @@ def get_upstream(git_dir, branch):
>      if remote == '.':
>          return merge, None
>      elif remote and merge:
> -        leaf = merge.split('/')[-1]
> -        return '%s/%s' % (remote, leaf), None
> +        # Drop the initial refs/heads from merge
> +        leaf = merge.split('/', maxsplit=2)[2:]
> +        return '%s/%s' % (remote, '/'.join(leaf)), None
>      else:
>          raise ValueError("Cannot determine upstream branch for branch "
>                           "'%s' remote='%s', merge='%s'"

Thanks for looking at this. Poking at this a little more and what git
does/doesn't allow in names, and also does/doesn't tell us easily via
git config, I think this is correct.

Reviewed-by: Tom Rini <trini at konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231030/3965659f/attachment.sig>


More information about the U-Boot mailing list