Commits

Anton Shestakov committed 233c3d7

Added git branch name; bash-fu.

Comments (0)

Files changed (1)

         fi
         if [[ "$GIT_TRACKED" ]] ; then
             local GIT_STATUS=$(git status 2>/dev/null)
+            local GIT_BRANCH=$(grep '# On branch' <<< "$GIT_STATUS" | cut -d' ' -f4-)
             
-            if [[ $(echo ${GIT_STATUS} | grep "# Your branch is behind") ]]; then
+            if [[ $(grep "# Your branch is behind" <<< "$GIT_STATUS") ]]; then
                 local GIT_UPDATE="$R^"
             fi
-            if [[ $(echo ${GIT_STATUS} | grep "# Changes to be committed:") ]]; then
+            if [[ $(grep "# Changes to be committed:" <<< "$GIT_STATUS") ]]; then
                 local GIT_STAGED="$R!"
             fi
-            if [[ $(echo ${GIT_STATUS} | grep "# Changes not staged for commit:") ]]; then
+            if [[ $(grep "# Changes not staged for commit:" <<< "$GIT_STATUS") ]]; then
                 local GIT_UNSTAGED="$P?"
             fi
             
-            local GIT_INFO=" ${G}±${GIT_STAGED}${GIT_UNSTAGED}${GIT_UPDATE}${RESET}"
+            local GIT_INFO=" ${G}${GIT_BRANCH}±${GIT_STAGED}${GIT_UNSTAGED}${GIT_UPDATE}${RESET}"
         fi
     fi