# Get current status.
while IFS=$'\n' read line; do
if [[ "$line" == \#\#\ * ]]; then
- [[ "$line" =~ '## ([^.]*)\.\.\.(.*)' ]] && branch=$match[1]
- [[ "$line" =~ 'ahead ([0-9]+)' ]] && ahead=$match[1]
- [[ "$line" =~ 'behind ([0-9]+)' ]] && behind=$match[1]
+ [[ "$line" =~ '## (.*?)(\.\.\.|$)' ]] && branch=$match[1]
+ [[ "$line" =~ 'ahead ([0-9]+)' ]] && ahead=$match[1]
+ [[ "$line" =~ 'behind ([0-9]+)' ]] && behind=$match[1]
else
# Count added, deleted, modified, renamed, unmerged, untracked, dirty.
# T (type change) is undocumented, see http://git.io/FnpMGw.
setopt notify
setopt rcquotes # echo 'don''t'; prints don't
setopt dvorak # correct_all uses dvorak
+setopt rematch_pcre # use perl regexp
# disable flow control
setopt noflowcontrol