Merge pull request #280 from hawkbee/hawkbee

Add git config option bash-it.hide-status to decide whether check git st...
pull/287/head
Travis Swicegood 2014-04-08 15:25:37 -05:00
commit 057755a91b
1 changed files with 9 additions and 4 deletions

View File

@ -73,6 +73,7 @@ function git_prompt_vars {
SCM_GIT_AHEAD=''
SCM_GIT_BEHIND=''
SCM_GIT_STASH=''
if [[ "$(git config --get bash-it.hide-status)" != "1" ]]; then
local status="$(git status -bs --porcelain 2> /dev/null)"
if [[ -n "$(grep -v ^# <<< "${status}")" ]]; then
SCM_DIRTY=1
@ -81,6 +82,10 @@ function git_prompt_vars {
SCM_DIRTY=0
SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN}
fi
else
SCM_DIRTY=0
SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN}
fi
SCM_PREFIX=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX}
SCM_SUFFIX=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX}