Skip to content

Commit 12ebac8

Browse files
committed
fix(diff): account for possible buffer wipeout during Git source attach
Resolve #1530
1 parent 1f782e3 commit 12ebac8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lua/mini/diff.lua

+4
Original file line numberDiff line numberDiff line change
@@ -1620,6 +1620,10 @@ H.git_start_watching_index = function(buf_id, path)
16201620
-- If path is not in Git, disable buffer but make sure that it will not try
16211621
-- to re-attach until buffer is properly disabled
16221622
local on_not_in_git = vim.schedule_wrap(function()
1623+
if not vim.api.nvim_buf_is_valid(buf_id) then
1624+
H.cache[buf_id] = nil
1625+
return
1626+
end
16231627
MiniDiff.disable(buf_id)
16241628
H.git_cache[buf_id] = {}
16251629
end)

0 commit comments

Comments
 (0)