buildman: Support upstream branch name containing /
PATCH 1/1 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.
---
tools/patman/gitutil.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/patman/gitutil.py +3 -2
@@ -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'"
Signature · 1 line
2.42.0.820.g83a721a137-goog
Quoted 20 lines · Simon Glass
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 <[email protected]>---
tools/patman/gitutil.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)tools/patman/gitutil.py +0
-0@@ -147,8 +147,9 @@ def get_upstream(git_dir, branch): if remote == '.':
tools/patman/gitutil.py def get_upstream(git_dir, branch): · line 155
Quoted 10 lines
tools/patman/gitutil.py +3
-2return 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.
Signature · 1 line
Tom