From 67629aba2d7a5404723f5ca1f3029d6eff24c263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Rogo=C5=BCa?= Date: Tue, 24 Apr 2018 21:50:34 +0200 Subject: [PATCH] On some hosts scm* functions does not work properly if a vcs tool is missing --- themes/base.theme.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index fda845de..22f53a67 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -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 }