aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/git
diff options
context:
space:
mode:
authorDoesnot Matter <you@example.com>2022-05-26 19:53:49 +0200
committerDoesnot Matter <you@example.com>2022-05-26 19:53:49 +0200
commit03348fd156b2bfc1d69197649b471b01a4620238 (patch)
treecd1bad3cfb9749e3bfd757bffb950fa19a77ca01 /gbp/git
parent3e30ce364e2a825355fcb30d6780cce508e8651b (diff)
repository: Add helper to prefix branch with 'refs/heads/'
No attempt is being made to ensure this is a local branch.
Diffstat (limited to 'gbp/git')
-rw-r--r--gbp/git/repository.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 4d11fae6..edbdfe9f 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -653,6 +653,16 @@ class GitRepository(object):
return out[0].decode().strip()
+ @staticmethod
+ def ensure_refs_heads(branch):
+ """
+ Make sure a branch name is prefixed with `refs/heads'
+ """
+ if (branch.startswith('refs/heads/')):
+ return branch
+ #return f'refs/heads/{branch}'
+ return f'{branch}'
+
#{ Tags
def create_tag(self, name, msg=None, commit=None, sign=False, keyid=None):