From a44cb1f2402a7f20f68e245bd37d6bdfe34e70f2 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 30 Oct 2023 10:22:30 -0700 Subject: [PATCH] buildman: Support upstream branch name containing / 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 Reviewed-by: Tom Rini --- 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 b0a12f2e8c..10ea5ff39f 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'" -- 2.39.5