Use pattern matching and matches array length for the number of commits.
`BASH_REMATCH` should work on `zsh` too, according to `man`.
This change gives like _6ms_ speed boost, so it's not the most important, but in terms of prompt responsiveness every millisecond counts