fix(zsg): fix git_current_branch
This commit is contained in:
parent
820d21b14d
commit
8f350fcaaf
@ -18,11 +18,11 @@ function current_branch() {
|
||||
|
||||
function git_current_branch() {
|
||||
local ref
|
||||
ref=$(__git_prompt_git symbolic-ref --quiet HEAD 2> /dev/null)
|
||||
ref=$(git symbolic-ref --quiet HEAD 2> /dev/null)
|
||||
local ret=$?
|
||||
if [[ $ret != 0 ]]; then
|
||||
[[ $ret == 128 ]] && return # no git repo.
|
||||
ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return
|
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||
fi
|
||||
echo ${ref#refs/heads/}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user