Merge pull request #1182 from dracorp/missing-vcs-tool

Function scm_prompt_info does not work properly if a vcs tool is missing
This commit is contained in:
Nils Winkler
2018-04-25 08:15:04 +02:00
committed by GitHub

View File

@@ -75,12 +75,12 @@ RBFU_THEME_PROMPT_SUFFIX='|'
function scm {
if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE
elif [[ -f .git/HEAD ]]; then SCM=$SCM_GIT
elif [[ -f .git/HEAD ]] && which git &> /dev/null; then SCM=$SCM_GIT
elif which git &> /dev/null && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then SCM=$SCM_GIT
elif which p4 &> /dev/null && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then SCM=$SCM_P4
elif [[ -d .hg ]]; then SCM=$SCM_HG
elif [[ -d .hg ]] && which hg &> /dev/null; 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
elif [[ -d .svn ]] && which svn &> /dev/null; then SCM=$SCM_SVN
else SCM=$SCM_NONE
fi
}