Skip to content

Commit

Permalink
chore: add better assertion message
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Jul 27, 2023
1 parent 11b80e7 commit 61e50f3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lua/gitsigns/hunks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,14 @@ end
--- @param untracked boolean
--- @return Gitsigns.Sign[]
function M.calc_signs(hunk, min_lnum, max_lnum, untracked)
assert(not untracked or hunk.type == 'add')
assert(
not untracked or hunk.type == 'add',
string.format(
'Invalid hunk with untracked=%s hunk="%s"',
untracked,
vim.inspect(hunk, untracked, vim.inspect(hunk.head))
)
)
min_lnum = min_lnum or 1
max_lnum = max_lnum or math.huge
local start, added, removed = hunk.added.start, hunk.added.count, hunk.removed.count
Expand Down

0 comments on commit 61e50f3

Please sign in to comment.