This is the function which does the work for Repository.merge_commits() and allows us more direct control over which trees we want to merge, including trees which do not belong to commits.