[Fix #37] Improve Git status parsing

main
Colin Hebert 13 years ago committed by Sorin Ionescu
parent cdb95f810f
commit 7d08a49432

@ -274,11 +274,13 @@ function git-info() {
fi fi
else else
# Count added, deleted, modified, renamed, unmerged, untracked, dirty. # Count added, deleted, modified, renamed, unmerged, untracked, dirty.
[[ "$line" == (((A|M|D|T) )|(AD|AM|AT|MM))\ * ]] && (( added++ )) # T (type change) is undocumented, see http://git.io/FnpMGw.
[[ "$line" == ( D|AD)\ * ]] && (( deleted++ )) # For a table of scenarii, see http://i.imgur.com/2YLu1.png.
[[ "$line" == (( (M|T))|(AM|AT|MM))\ * ]] && (( modified++ )) [[ "$line" == ([ACDMT][\ MT]|[ACMT]D)\ * ]] && (( added++ ))
[[ "$line" == R\ \ * ]] && (( renamed++ )) [[ "$line" == [\ ACMRT]D\ * ]] && (( deleted++ ))
[[ "$line" == UU\ * ]] && (( unmerged++ )) [[ "$line" == ?[MT]\ * ]] && (( modified++ ))
[[ "$line" == R?\ * ]] && (( renamed++ ))
[[ "$line" == (AA|DD|U?|?U)\ * ]] && (( unmerged++ ))
[[ "$line" == \?\?\ * ]] && (( untracked++ )) [[ "$line" == \?\?\ * ]] && (( untracked++ ))
(( dirty++ )) (( dirty++ ))
fi fi

Loading…
Cancel
Save