Skip to content

Commit

Permalink
fix: accommodate watcher receiving a nil filename. (#851)
Browse files Browse the repository at this point in the history
* fix: accommodate watcher receiving a nil filename.

* fix: add a comment for the watcher callback nil filename check.
  • Loading branch information
otrho committed Aug 9, 2023
1 parent 287fffb commit bae45ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/gitsigns/watcher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ function M.watch_gitdir(bufnr, gitdir)

local info = string.format("Git dir update: '%s' %s", filename, inspect(events))

if vim.endswith(filename, '.lock') then
-- The luv docs say filename is passed as a string but it has been observed
-- to sometimes be nil.
-- https://github.com/lewis6991/gitsigns.nvim/issues/848
if filename == nil or vim.endswith(filename, '.lock') then
dprintf('%s (ignoring)', info)
return
end
Expand Down

0 comments on commit bae45ef

Please sign in to comment.