Move merge base calculation to GTRepository

Also accept `GTOID`s instead of `GTBranch`es for the arguments.