git status --porcelain instead of git ls-files
git rev-list for ahead/behind count

git rev-list --left-right --count @{upstream}...HEAD outputs:
X   Y
where X is the number of commits the left side has ('behind,')
and Y is the number of commits the right side has ('ahead.')

This lets us get a precise count of aheads and behinds easily,
doing away with pattern matching and also letting us be a bit
more intelligent about when automatic updating is a good idea.