Merge pull request #191 from jaesivsm/develop

light bug in "git diff --shortstat" parsing
This commit is contained in:
nojhan 2013-05-28 02:07:20 -07:00
commit 8757c58243

View File

@ -731,9 +731,10 @@ _lp_git_branch_color()
local shortstat=$(LANG=C git diff --shortstat 2>/dev/null) local shortstat=$(LANG=C git diff --shortstat 2>/dev/null)
if [[ -n "$shortstat" ]] ; then 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)}') #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, /+} local has_lines=${shortstat/*changed, /}
has_lines=${has_lines/ insertions(+), /\/-} has_lines=${has_lines/ inser*, /\/-}
has_lines=${has_lines/ del*/} has_lines=${has_lines/ del*/}
[[ "$shortstat" = *insertion* ]] && has_lines="+${has_lines/ inser*/}" || has_lines="-$has_lines"
if [[ "$has_commit" -gt "0" ]] ; then if [[ "$has_commit" -gt "0" ]] ; then
# Changes to commit and commits to push # Changes to commit and commits to push