aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/git.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/utils/git.py')
-rw-r--r--meta/lib/oeqa/utils/git.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/git.py b/meta/lib/oeqa/utils/git.py
index 647465467d..0fc8112321 100644
--- a/meta/lib/oeqa/utils/git.py
+++ b/meta/lib/oeqa/utils/git.py
@@ -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
+