mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
oeqa.utils.git: implement GitRepo.get_current_branch()
(From OE-Core rev: dcba2302adab47b398f1ce7d09c38828ea9ae426) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
6cf74643e9
commit
618a2ede75
@@ -46,4 +46,12 @@ class GitRepo(object):
|
||||
# Revision does not exist
|
||||
return None
|
||||
|
||||
def get_current_branch(self):
|
||||
"""Get current branch"""
|
||||
try:
|
||||
# Strip 11 chars, i.e. 'refs/heads' from the beginning
|
||||
return self.run_cmd(['symbolic-ref', 'HEAD'])[11:]
|
||||
except GitError:
|
||||
return None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user