Deal with <2 commits for find_merge_base

lethe/HEAD
jan 5 years ago
parent 668efd063a
commit 3665d1db88

@ -109,6 +109,12 @@ def find_merge_base(commits: List[str], cwd: str=None) -> str:
"""
Find the "best common ancestor" commit.
"""
if len(commits) == 0:
raise Exception('Called find_merge_base with no commits!')
if len(commits) == 1:
return commits[0]
base = _run(['git', 'merge-base', *commits], cwd=cwd)
return base

Loading…
Cancel
Save