Download:
child 11:2439664df022
parent 9:d83f081c6a41
10:233c3d76cc7d
Anton Shestakov <engored@ya.ru>, Fri, 01 Jun 2012 20:27:08 +0900
Added git branch name; bash-fu.

1 файлов изменено, 5 вставок(+), 4 удалений(-) [+]
.bash_prompt file | annotate | diff | comparison | revisions
--- a/.bash_prompt Fri Jun 01 20:20:07 2012 +0900
+++ b/.bash_prompt Fri Jun 01 20:27:08 2012 +0900
@@ -39,18 +39,19 @@
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