aboutsummaryrefslogtreecommitdiff
path: root/tools/patman/gitutil.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-10-30 10:22:30 -0700
committerTom Rini <trini@konsulko.com>2023-11-02 22:38:01 -0400
commita44cb1f2402a7f20f68e245bd37d6bdfe34e70f2 (patch)
tree94a9ed7f6c3803476280bc5e6bd16cdef11d24c5 /tools/patman/gitutil.py
parentbe6a249b417fb159db6fc3f4b7d72eb2fd036554 (diff)
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 <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'tools/patman/gitutil.py')
-rw-r--r--tools/patman/gitutil.py5
1 files 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'"