From f2f0346864d4ff884b702f605c60d695cf03814f Mon Sep 17 00:00:00 2001 From: Matt Hamilton Date: Fri, 18 Dec 2015 10:57:19 -0500 Subject: [PATCH] add git_current_branch for theme compatibility --- modules/git/functions/git_current_branch | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 modules/git/functions/git_current_branch diff --git a/modules/git/functions/git_current_branch b/modules/git/functions/git_current_branch new file mode 100644 index 0000000..b035ea0 --- /dev/null +++ b/modules/git/functions/git_current_branch @@ -0,0 +1,9 @@ +# slightly modified git_current_branch from oh-my-zsh for theme compatibility +local ref +ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null) +local ret=$? +if [[ $ret != 0 ]]; then + [[ $ret == 128 ]] && return # no git repo. + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return +fi +print ${ref#refs/heads/}