Skip to content

Commit

Permalink
Test out a more limited watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
CKolkey committed Jul 3, 2023
1 parent f52f209 commit e0eb484
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lua/neogit/watcher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function M.watch_git_dir(gitdir)
end

local watch_gitdir_handler_db = util.debounce_trailing(
300,
200,
a.void(function()
logger.debug("[WATCHER] Dispatching Refresh")
git.repo:dispatch_refresh { callback = status.dispatch_refresh, source = "watcher" }
Expand All @@ -54,7 +54,7 @@ function M.watch_git_dir(gitdir)
{},
a.void(function(err, filename, events)
if err then
logger.error("[WATCHER] Git dir update error: %s", err)
logger.error(string.format("[WATCHER] Git dir update error: %s", err))
return
end

Expand All @@ -64,17 +64,14 @@ function M.watch_git_dir(gitdir)
vim.inspect(events, { indent = "", newline = " " })
)

-- stylua: ignore
if
filename:match("%.lock$") or
filename:match("COMMIT_EDITMSG")
then
logger.debug(string.format("%s (ignoring)", info))
if filename:match("%.lock$") then
return
end

logger.debug(info)
watch_gitdir_handler_db()
if filename:match("^index$") or filename:match("HEAD$") then
watch_gitdir_handler_db()
end
end)
)

Expand Down

0 comments on commit e0eb484

Please sign in to comment.