Skip to content

Commit c8b6848

Browse files
committed
chore: resolve undefined-field
1 parent 1c8b343 commit c8b6848

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lua/nvim-tree/explorer/filters.lua

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,25 @@ end
5757

5858
---Check if the given path is git clean/ignored
5959
---@param path string Absolute path
60-
---@param git_status table from prepare
60+
---@param project GitProject from prepare
6161
---@return boolean
62-
local function git(self, path, git_status)
63-
if type(git_status) ~= "table" or type(git_status.files) ~= "table" or type(git_status.dirs) ~= "table" then
62+
local function git(self, path, project)
63+
if type(project) ~= "table" or type(project.files) ~= "table" or type(project.dirs) ~= "table" then
6464
return false
6565
end
6666

6767
-- default status to clean
68-
local status = git_status.files[path]
69-
status = status or git_status.dirs.direct[path] and git_status.dirs.direct[path][1]
70-
status = status or git_status.dirs.indirect[path] and git_status.dirs.indirect[path][1]
68+
local xy = project.files[path]
69+
xy = xy or project.dirs.direct[path] and project.dirs.direct[path][1]
70+
xy = xy or project.dirs.indirect[path] and project.dirs.indirect[path][1]
7171

7272
-- filter ignored; overrides clean as they are effectively dirty
73-
if self.config.filter_git_ignored and status == "!!" then
73+
if self.config.filter_git_ignored and xy == "!!" then
7474
return true
7575
end
7676

7777
-- filter clean
78-
if self.config.filter_git_clean and not status then
78+
if self.config.filter_git_clean and not xy then
7979
return true
8080
end
8181

@@ -180,12 +180,12 @@ end
180180
---Prepare arguments for should_filter. This is done prior to should_filter for efficiency reasons.
181181
---@param project GitProject? optional results of git.load_projects(...)
182182
---@return table
183-
--- git_status: reference
183+
--- project: reference
184184
--- bufinfo: empty unless no_buffer set: vim.fn.getbufinfo { buflisted = 1 }
185185
--- bookmarks: absolute paths to boolean
186186
function Filters:prepare(project)
187187
local status = {
188-
git_status = project or {},
188+
project = project or {},
189189
bufinfo = {},
190190
bookmarks = {},
191191
}
@@ -219,7 +219,7 @@ function Filters:should_filter(path, fs_stat, status)
219219
return false
220220
end
221221

222-
return git(self, path, status.git_status)
222+
return git(self, path, status.project)
223223
or buf(self, path, status.bufinfo)
224224
or dotfile(self, path)
225225
or custom(self, path)
@@ -240,7 +240,7 @@ function Filters:should_filter_as_reason(path, fs_stat, status)
240240
return FILTER_REASON.none
241241
end
242242

243-
if git(self, path, status.git_status) then
243+
if git(self, path, status.project) then
244244
return FILTER_REASON.git
245245
elseif buf(self, path, status.bufinfo) then
246246
return FILTER_REASON.buf

0 commit comments

Comments
 (0)