Use low level command to detect branches behind

Using git log is subject to formatting in .gitconfig, which can be
overridden and will break this function. Relying on rev-list is much
more stable.