@@ -3,14 +3,15 @@ local log = require("neo-tree.log")
3
3
local git_utils = require (" neo-tree.git.utils" )
4
4
5
5
local M = {}
6
+ local sep = utils .path_separator
6
7
7
8
M .load_ignored_per_directory = function (path )
8
9
if type (path ) ~= " string" then
9
10
log .error (" load_ignored_per_directory: path must be a string" )
10
11
return {}
11
12
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 )
14
15
local result = vim .fn .systemlist (cmd )
15
16
if vim .v .shell_error == 128 then
16
17
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)
25
26
for i , item in ipairs (result ) do
26
27
local stat = vim .loop .fs_stat (item )
27
28
if stat and stat .type == " directory" then
28
- result [i ] = item .. utils . path_separator
29
+ result [i ] = item .. sep
29
30
end
30
31
end
31
32
return result
@@ -65,7 +66,7 @@ M.load_ignored = function(path)
65
66
end
66
67
67
68
M .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
69
70
for _ , v in ipairs (ignored ) do
70
71
if v :sub (- 1 ) == utils .path_separator then
71
72
-- directory ignore
0 commit comments