Cache results of git merge-base.
Port more caching from the hg backend to the git backend.