From f6d16d3fcbc518d9724f38a8b4674492d26ad391 Mon Sep 17 00:00:00 2001 From: Toby Hutton Date: Wed, 9 Aug 2023 17:49:47 +1000 Subject: [PATCH] fix: add a comment for the watcher callback nil filename check. --- lua/gitsigns/watcher.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/gitsigns/watcher.lua b/lua/gitsigns/watcher.lua index 937e4710..71071b7c 100644 --- a/lua/gitsigns/watcher.lua +++ b/lua/gitsigns/watcher.lua @@ -116,6 +116,9 @@ function M.watch_gitdir(bufnr, gitdir) local info = string.format("Git dir update: '%s' %s", filename, inspect(events)) + -- 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