diff --git a/lethe.py b/lethe.py index 71e700c..5915a64 100755 --- a/lethe.py +++ b/lethe.py @@ -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