Allow getting the merge base of more than 2 commits.

Add support for determining the merge base of more than 2 commits.