From 7d08a49432e037981c91f3888d21aa10279bde21 Mon Sep 17 00:00:00 2001 From: Colin Hebert Date: Thu, 8 Mar 2012 21:58:03 +0000 Subject: [PATCH] [Fix #37] Improve Git status parsing --- plugins/git/functions/git-info | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/git/functions/git-info b/plugins/git/functions/git-info index 0b139820..d0602856 100644 --- a/plugins/git/functions/git-info +++ b/plugins/git/functions/git-info @@ -274,11 +274,13 @@ function git-info() { fi else # Count added, deleted, modified, renamed, unmerged, untracked, dirty. - [[ "$line" == (((A|M|D|T) )|(AD|AM|AT|MM))\ * ]] && (( added++ )) - [[ "$line" == ( D|AD)\ * ]] && (( deleted++ )) - [[ "$line" == (( (M|T))|(AM|AT|MM))\ * ]] && (( modified++ )) - [[ "$line" == R\ \ * ]] && (( renamed++ )) - [[ "$line" == UU\ * ]] && (( unmerged++ )) + # T (type change) is undocumented, see http://git.io/FnpMGw. + # For a table of scenarii, see http://i.imgur.com/2YLu1.png. + [[ "$line" == ([ACDMT][\ MT]|[ACMT]D)\ * ]] && (( added++ )) + [[ "$line" == [\ ACMRT]D\ * ]] && (( deleted++ )) + [[ "$line" == ?[MT]\ * ]] && (( modified++ )) + [[ "$line" == R?\ * ]] && (( renamed++ )) + [[ "$line" == (AA|DD|U?|?U)\ * ]] && (( unmerged++ )) [[ "$line" == \?\?\ * ]] && (( untracked++ )) (( dirty++ )) fi