On some hosts scm* functions does not work properly if a vcs tool is missing

pull/1182/head
Piotr Rogoża 2018-04-24 21:50:34 +02:00
parent 1972196c5a
commit 67629aba2d
1 changed files with 3 additions and 3 deletions

View File

@ -75,12 +75,12 @@ RBFU_THEME_PROMPT_SUFFIX='|'
function scm { function scm {
if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE 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 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 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 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 else SCM=$SCM_NONE
fi fi
} }