From 03348fd156b2bfc1d69197649b471b01a4620238 Mon Sep 17 00:00:00 2001 From: Doesnot Matter Date: Thu, 26 May 2022 19:53:49 +0200 Subject: repository: Add helper to prefix branch with 'refs/heads/' No attempt is being made to ensure this is a local branch. --- gbp/git/repository.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gbp/git') 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): -- cgit v1.2.3