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 31fbda6
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
merge_base ? repo.lookup(merge_base) : repo.rev_parse(compare_base)
end

def head
Expand Down

0 comments on commit 31fbda6

Please sign in to comment.