Make fewer calls to git

`git rev-list --left-right` provides output that can be used to determine
whether there is an upstream branch, and how many changes there have been on
each branch since their merge base. It is in the format:

    [number of changes locally] [tab] [number of spaces remotely]

Use this output to determine what action to take rather than making separate
calls or checks for each state in ahead / behind / diverged / no changes.
Without benchmarking I can't be sure, but this is almost certainly a faster way
to get the information.

* Refactor each branch of the case statement into a function.
* Move closer to Git's coding guidelines:
  https://github.com/git/git/blob/master/Documentation/CodingGuidelines
  * Remove function keywords from `success` and `failure`. These are
    noise-words in sh and are all that prevents `git-update` from being
    executed by other shells.
  * Space between function name and `()`.