fix the state part of the git prompt

This commit is contained in:
Haak Saxberg 2014-03-19 10:30:05 -07:00
parent df27f5b21f
commit 354bb1f5a4

View file

@ -21,7 +21,7 @@ parse_git_branch() {
branch_pattern="^# On branch ([^${IFS}]*)" branch_pattern="^# On branch ([^${IFS}]*)"
remote_pattern="# Your branch is (.*) of" remote_pattern="# Your branch is (.*) of"
diverge_pattern="# Your branch and (.*) have diverged" diverge_pattern="# Your branch and (.*) have diverged"
if [[ ! ${git_status} =~ "working directory clean" ]]; then if [[ ! ${git_status} =~ "nothing to commit" ]]; then
state="${RED}!" state="${RED}!"
else else
state="" state=""
@ -39,7 +39,7 @@ parse_git_branch() {
fi fi
if [[ ${git_status} =~ ${branch_pattern} ]]; then if [[ ${git_status} =~ ${branch_pattern} ]]; then
branch=${BASH_REMATCH[1]} branch=${BASH_REMATCH[1]}
echo " $RED(${branch} ${remote}${state}) " echo " $RED(${branch} ${remote}${state}$RED) "
fi fi
} }