Show rev info when in detached HEAD

If you're in a detached HEAD state, it's not a symbolic ref, and so
`$branch` was left empty.
This commit is contained in:
Hristos N. Triantafillou 2016-03-26 10:40:11 -05:00
parent 4f19700919
commit f6f767c78a

View file

@ -215,7 +215,8 @@ function git-info {
fi
# Get the branch.
branch="${$(git symbolic-ref HEAD 2> /dev/null)#refs/heads/}"
branch="${$(git symbolic-ref HEAD 2> /dev/null)#refs/heads/}" \
|| branch="$(git rev-parse --short HEAD 2> /dev/null)"
# Format branch.
zstyle -s ':prezto:module:git:info:branch' format 'branch_format'