Deal with <2 commits for find_merge_base
This commit is contained in:
parent
668efd063a
commit
3665d1db88
6
lethe.py
6
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user