Add git config option bash-it.hide-status to decide whether check git status.
authorhequn <hawkbee@gmail.com>
Wed, 2 Apr 2014 10:41:28 +0000 (18:41 +0800)
committerhequn <hawkbee@gmail.com>
Wed, 2 Apr 2014 10:41:28 +0000 (18:41 +0800)
themes/base.theme.bash

index 157f088..ef2e5b7 100644 (file)
@@ -73,10 +73,15 @@ function git_prompt_vars {
   SCM_GIT_AHEAD=''
   SCM_GIT_BEHIND=''
   SCM_GIT_STASH=''
-  local status="$(git status -bs --porcelain 2> /dev/null)"
-  if [[ -n "$(grep -v ^# <<< "${status}")" ]]; then
-    SCM_DIRTY=1
-    SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
+  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
+      SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
+    else
+      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}