1
0
Fork 0
mirror of synced 2024-12-26 07:53:21 -05:00
zimfw/modules/git/functions/git_current_branch

11 lines
339 B
Text
Raw Normal View History

# vim:et sts=2 sw=2 ft=zsh
# slightly modified git_current_branch from oh-my-zsh for theme compatibility
local ref
ref=$(command git symbolic-ref -q --short HEAD 2>/dev/null)
local -i ret=${?}
if (( ret )); then
(( ret == 128 )) && return # no git repo.
ref=$(command git rev-parse --short HEAD 2>/dev/null) || return
fi
print ${ref}