light bug in "git diff --shortstat" parsing

the string substitution assumed "insertions" was always plural, but git
actually takes care of suffixing insertion with an "s" only if there is
more than one insertion
This commit is contained in:
François Schmidts 2013-05-25 20:38:15 +02:00
parent 29c9820786
commit 430d9bf6b9

View File

@ -732,7 +732,7 @@ _lp_git_branch_color()
if [[ -n "$shortstat" ]] ; then
#has_lines=$(git diff --numstat 2>/dev/null | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d/-%d\n", plus, minus)}')
local has_lines=${shortstat/*changed, /+}
has_lines=${has_lines/ insertions(+), /\/-}
has_lines=${has_lines/ inser*, /\/-}
has_lines=${has_lines/ del*/}
if [[ "$has_commit" -gt "0" ]] ; then