From 8910f5decaaae1dd6de157b93833bcf872f95b4f Mon Sep 17 00:00:00 2001 From: Jan Gosmann Date: Sat, 25 Feb 2012 22:37:01 +0100 Subject: [PATCH] Display detached head state in git prompt. --- lib/git.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index fb4ad8ca6..534c1072c 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -1,6 +1,7 @@ # get the name of the branch we are on 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" }