1
0
Fork 0
mirror of synced 2024-06-28 03:11:09 -04:00
zimfw/modules/git/functions/git_current_branch
2015-12-18 10:57:19 -05:00

10 lines
325 B
Plaintext

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