[Fix #37] Improve Git status parsing

This commit is contained in:
Colin Hebert 2012-03-08 21:58:03 +00:00 committed by Sorin Ionescu
parent cdb95f810f
commit 7d08a49432

View File

@ -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