This should be customizable by the caller.  And more interestingly, I'd love to use this in Gerrit Code Review, and also to implement the recursive variant for multiple merge bases.

The latter two uses require that we *do not* have a working tree during the merge, and also that we don't lockDirCache() above but instead create a new in-core only DirCache.