]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
buildman: Support upstream branch name containing /
authorSimon Glass <sjg@chromium.org>
Mon, 30 Oct 2023 17:22:30 +0000 (10:22 -0700)
committerTom Rini <trini@konsulko.com>
Fri, 3 Nov 2023 02:38:01 +0000 (22:38 -0400)
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>
tools/patman/gitutil.py

index b0a12f2e8c0648d8dd3488a5556f007856197b24..10ea5ff39f5c3ac65d2278e366201d4ddbed5f54 100644 (file)
@@ -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'"