@@ -18,14 +18,16 @@ local function do_scan(context, path_to_scan)
1818 local paths_to_load = context .paths_to_load
1919 local folders = context .folders
2020 local filters = state .filters or {}
21+ local use_gitignore_table = filters .respect_gitignore and filters .gitignore_source == " git"
2122
2223 scan .scan_dir_async (path_to_scan , {
2324 hidden = filters .show_hidden or false ,
2425 search_pattern = state .search_pattern or nil ,
26+ respect_gitignore = filters .respect_gitignore and filters .gitignore_source == " plenary" ,
2527 add_dirs = true ,
2628 depth = 1 ,
2729 on_insert = function (path , _type )
28- if not filters . respect_gitignore or not git .is_ignored (state .git_ignored , path , _type ) then
30+ if not use_gitignore_table or not git .is_ignored (state .git_ignored , path , _type ) then
2931 local success , _ = pcall (file_items .create_item , context , path , _type )
3032 if not success then
3133 log .error (" error creating item for " , path )
@@ -126,8 +128,8 @@ M.get_items_async = function(state, parent_id, path_to_reveal, callback)
126128 context .paths_to_load = {}
127129 if parent_id == nil then
128130 if utils .truthy (state .force_open_folders ) then
129- for _ , path in ipairs (state .force_open_folders ) do
130- table.insert (context .paths_to_load , path )
131+ for _ , f in ipairs (state .force_open_folders ) do
132+ table.insert (context .paths_to_load , f )
131133 end
132134 elseif state .tree then
133135 context .paths_to_load = renderer .get_expanded_nodes (state .tree , state .path )
@@ -148,7 +150,11 @@ M.get_items_async = function(state, parent_id, path_to_reveal, callback)
148150 context .paths_to_load = utils .unique (context .paths_to_load )
149151 end
150152
151- state .git_ignored = state .filters .respect_gitignore and git .load_ignored (state .path ) or {}
153+ if state .filters .respect_gitignore and state .filters .gitignore_source == " git" then
154+ state .git_ignored = git .load_ignored (state .path ) or {}
155+ else
156+ state .git_ignored = {}
157+ end
152158 end
153159 do_scan (context , parent_id or state .path )
154160 end
0 commit comments