typo and git ahead info

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2017-11-09 16:10:14 +03:00
parent 8ec75e7abe
commit 631986f76a

View File

@ -51,7 +51,7 @@ precmd.is_git_repo() {
if [[ -r "$_pwd/.git/HEAD" ]]; then
return 0
else
_pwd=${pwd%/*}
_pwd=${_pwd%/*}
fi
done
@ -72,6 +72,14 @@ precmd.git() {
done < <(git status --porcelain -bu 2>/dev/null)
git_branch_name=${git_branch_info%%...*}
[[ $git_branch_info =~ ahead\ ([0-9]+) ]] && git_ahead=$match[1]
git_status_colour='green'
(( git_ahead )) && {
git_status_short+='a'
git_status_colour='yellow'
}
(( git_unstaged )) && {
git_status_short+='c'
@ -84,8 +92,6 @@ precmd.git() {
}
git_status_short=${git_status_short:-"ok"}
git_status_colour=${git_status_colour:-"green"}
git_prompt_msg="(%F{cyan}$git_branch_name%f[%F{$git_status_colour}${git_status_short}%f]) "
printf '%s' $git_prompt_msg