add git_current_branch for theme compatibility

This commit is contained in:
Matt Hamilton 2015-12-18 10:57:19 -05:00
parent 5cf08f503f
commit f2f0346864
1 changed files with 9 additions and 0 deletions

View File

@ -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/}