feat(git): support DA state, fix(#1822): test directory capable of watching before presenting it (#1905)
* fix(#1822): test directory capable of watching before presenting it (#1901) * feat(git): support `DA` state Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
@@ -159,4 +159,29 @@ function M.purge_watchers()
|
||||
end
|
||||
end
|
||||
|
||||
--- Windows NT will present directories that cannot be enumerated.
|
||||
--- Detect these by attempting to start an event monitor.
|
||||
--- @param path string
|
||||
--- @return boolean
|
||||
function M.is_fs_event_capable(path)
|
||||
if not utils.is_windows then
|
||||
return true
|
||||
end
|
||||
|
||||
local fs_event = vim.loop.new_fs_event()
|
||||
if not fs_event then
|
||||
return false
|
||||
end
|
||||
|
||||
if fs_event:start(path, FS_EVENT_FLAGS, function() end) ~= 0 then
|
||||
return false
|
||||
end
|
||||
|
||||
if fs_event:stop() ~= 0 then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user