optimize this a bit
authorTravis Swicegood <development@domain51.com>
Tue, 1 May 2012 22:25:47 +0000 (17:25 -0500)
committerTravis Swicegood <development@domain51.com>
Tue, 1 May 2012 22:25:47 +0000 (17:25 -0500)
themes/doubletime/doubletime.theme.bash

index a01bf79..87ced7e 100644 (file)
@@ -59,14 +59,15 @@ $(doubletime_scm_prompt)$reset_color $ "
 PROMPT_COMMAND=prompt_setter
 
 git_prompt_status() {
-
-  if [ -n "$(git status | grep 'Changes not staged' 2> /dev/null)" ]; then
+  local git_status_output
+  git_status_output=$(git status 2> /dev/null )
+  if [ -n "$(echo $git_status_output | grep 'Changes not staged')" ]; then
     git_status="${bold_red}$(scm_prompt_info) ✗"
-  elif [ -n "$(git status | grep 'Changes to be committed' 2> /dev/null)" ]; then
+  elif [ -n "$(echo $git_status_output | grep 'Changes to be committed')" ]; then
      git_status="${bold_yellow}$(scm_prompt_info) ^"
-  elif [ -n "$(git status | grep 'Untracked files' 2> /dev/null)" ]; then
+  elif [ -n "$(echo $git_status_output | grep 'Untracked files')" ]; then
      git_status="${bold_cyan}$(scm_prompt_info) +"
-  elif [ -n "$(git status | grep 'nothing to commit' 2> /dev/null)" ]; then
+  elif [ -n "$(echo $git_status_output | grep 'nothing to commit')" ]; then
      git_status="${bold_green}$(scm_prompt_info) ${green}✓"
   else
     git_status="$(scm_prompt_info)"