From 6662cadfe849cd819980c6f9c9b4baeab0525a3d Mon Sep 17 00:00:00 2001 From: terminalforlife Date: Wed, 17 Feb 2021 22:57:20 +0000 Subject: [PATCH] Undo my change to git command usage (the test) This reverts commit 12e225afefbe77a2fa478f9fb0425d353b5a4cc0. Didn't realise when in '.git', it will return `0` but still show `false`; git(1) is quite finicky, somtimes. --- themes/base.theme.bash | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index d08ff70c..f0f74a7d 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -104,7 +104,7 @@ function scm { SCM=$SCM_NONE elif [[ -f .git/HEAD ]] && [[ -x "$GIT_EXE" ]]; then SCM=$SCM_GIT - elif [[ -x "$GIT_EXE" ]] && git rev-parse --is-inside-work-tree &> /dev/null; then + elif [[ -x "$GIT_EXE" ]] && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then SCM=$SCM_GIT elif [[ -x "$P4_EXE" ]] && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then SCM=$SCM_P4 @@ -181,8 +181,10 @@ function scm_prompt_info_common { } function terraform_workspace_prompt { - if _command_exists terraform && [ -d .terraform ]; then - echo -e "$(terraform workspace show 2> /dev/null)" + if _command_exists terraform; then + if [ -d .terraform ]; then + echo -e "$(terraform workspace show 2> /dev/null)" + fi fi }