diff --git a/liquidprompt b/liquidprompt index 840e3fd..ccec9c5 100755 --- a/liquidprompt +++ b/liquidprompt @@ -741,7 +741,8 @@ _lp_git_branch_color() branch="$(_lp_git_branch)" if [[ -n "$branch" ]] ; then - local end="$NO_COL" + local end + end="$NO_COL" if \git status 2>/dev/null | grep -q '\(# Untracked\)'; then end="$LP_COLOR_CHANGES$LP_MARK_UNTRACKED$end" fi @@ -766,10 +767,12 @@ _lp_git_branch_color() fi fi - local shortstat="$(LANG=C \git diff --shortstat 2>/dev/null)" + local shortstat + shortstat="$(LANG=C \git diff --shortstat 2>/dev/null)" if [[ -n "$shortstat" ]] ; then + local has_lines #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=${shortstat/*changed, /} has_lines=${has_lines/ inser*, /\/-} has_lines=${has_lines/ del*/} [[ "$shortstat" = *insertion* ]] && has_lines="+${has_lines/ inser*/}" || has_lines="-$has_lines"