File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -32,13 +32,15 @@ alias __git_branch="git branch 2>/dev/null | grep '*' | sed 's/*\ //g'"
32
32
# From http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt
33
33
# Modified.
34
34
_git_status() {
35
- git branch &>/dev/null || return 1
36
- if LC_ALL=C git status | grep -q "nothing to commit"; then
37
- echo -e "\01\e[1m\02@\01\e[0;32m\0002$(__git_branch)\01\e[0m\02"
38
- elif LC_ALL=C git status | grep -q "nothing added to commit"; then # Untracked
39
- echo -e "\01\e[1m\02@\01\e[0;35m\0002$(__git_branch)\01\e[0m\02"
35
+ local gbr=$(git branch 2>/dev/null) || return 1
36
+ gbr=$(printf %s "$gbr" | grep '*' | sed 's/*\ //g')
37
+ local gst=$(LC_ALL=C git status)
38
+ if printf %s "$gst" | grep -q "nothing to commit"; then
39
+ echo -e "\01\e[1m\02@\01\e[0;32m\0002$gbr\01\e[0m\02"
40
+ elif printf %s "$gst" || grep -q "nothing added to commit"; then # Untracked
41
+ echo -e "\01\e[1m\02@\01\e[0;35m\0002$gbr\01\e[0m\02"
40
42
else # Change not added/not merged yet
41
- echo -e "\01\e[1m\02@\01$IRED\0002$(__git_branch) \01\e[0m\02"
43
+ echo -e "\01\e[1m\02@\01$IRED\0002$gbr \01\e[0m\02"
42
44
fi
43
45
}
44
46
You can’t perform that action at this time.
0 commit comments