From c711b1b575f9f685a9a96506263bc5cd9bfb3251 Mon Sep 17 00:00:00 2001 From: Dan Wendorf Date: Thu, 16 Jul 2015 17:51:33 -0700 Subject: [PATCH] Show git prompt when in a detached HEAD state The current check of `git symbolic-ref HEAD` does not detect git repositories in the 'detached HEAD' state. This is the state a repository is in if HEAD is not pointing to a valid branch or tag (e.g. you are in a recently-initiated submodule). --- themes/base.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index f6e4da83..2bf16252 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -47,7 +47,7 @@ RBFU_THEME_PROMPT_SUFFIX='|' function scm { if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE elif [[ -f .git/HEAD ]]; then SCM=$SCM_GIT - elif which git &> /dev/null && [[ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]]; then SCM=$SCM_GIT + elif which git &> /dev/null && [[ -n "$(git rev-parse 2> /dev/null)" ]]; then SCM=$SCM_GIT elif [[ -d .hg ]]; then SCM=$SCM_HG elif which hg &> /dev/null && [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$SCM_HG elif [[ -d .svn ]]; then SCM=$SCM_SVN