@@ -3,14 +3,15 @@ local log = require("neo-tree.log")
33local git_utils = require (" neo-tree.git.utils" )
44
55local M = {}
6+ local sep = utils .path_separator
67
78M .load_ignored_per_directory = function (path )
89 if type (path ) ~= " string" then
910 log .error (" load_ignored_per_directory: path must be a string" )
1011 return {}
1112 end
12- path = vim .fn .shellescape (path ) .. utils . path_separator .. " * "
13- local cmd = " git check-ignore " .. path
13+ local esc_path = vim .fn .shellescape (path )
14+ local cmd = string.format ( " git -C %s check-ignore %s%s* " , esc_path , esc_path , sep )
1415 local result = vim .fn .systemlist (cmd )
1516 if vim .v .shell_error == 128 then
1617 if utils .truthy (result ) and vim .startswith (result [1 ], " fatal: not a git repository" ) then
@@ -25,7 +26,7 @@ M.load_ignored_per_directory = function(path)
2526 for i , item in ipairs (result ) do
2627 local stat = vim .loop .fs_stat (item )
2728 if stat and stat .type == " directory" then
28- result [i ] = item .. utils . path_separator
29+ result [i ] = item .. sep
2930 end
3031 end
3132 return result
@@ -65,7 +66,7 @@ M.load_ignored = function(path)
6566end
6667
6768M .is_ignored = function (ignored , path , _type )
68- path = _type == " directory" and (path .. utils . path_separator ) or path
69+ path = _type == " directory" and (path .. sep ) or path
6970 for _ , v in ipairs (ignored ) do
7071 if v :sub (- 1 ) == utils .path_separator then
7172 -- directory ignore
0 commit comments