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
seperate calls or checks for each of ahead / behind / diverged / no
changes.

* Refactor each branch into a function
* 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.
* Move closer to Git's coding guidelines:
  https://github.com/git/git/blob/master/Documentation/CodingGuidelines