Display detached head state in git prompt.

This commit is contained in:
Jan Gosmann 2012-02-25 22:37:01 +01:00
commit 8910f5deca

View file

@ -1,6 +1,7 @@
# get the name of the branch we are on # get the name of the branch we are on
function git_prompt_info() { function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return git rev-parse 2> /dev/null || return
ref=$(git symbolic-ref HEAD 2> /dev/null || print '(no branch)')
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
} }