Skip to content

Commit

Permalink
Handle nil merge_base in Changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
grodowski committed Jun 27, 2024
1 parent 82d12e2 commit 89236e8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/undercover/changeset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def full_diff
def compare_base_obj
return nil unless compare_base

repo.lookup(repo.merge_base(compare_base.to_s, head))
merge_base = repo.merge_base(compare_base.to_s, head)
# merge_base may be nil with --depth 1, compare two refs directly
repo.lookup(merge_base || compare_base)
end

def head
Expand Down

0 comments on commit 89236e8

Please sign in to comment.