Skip to content

Commit f52c9f1

Browse files
committed
chore: add extra logging for giti ignored work, part of #236
1 parent 63ddbd8 commit f52c9f1

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

lua/neo-tree/git/ignored.lua

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ end
4949

5050
M.mark_ignored = function(state, items)
5151
local git_roots = {}
52+
log.trace("================================================================================")
53+
log.trace("IGNORED: mark_ignore BEGIN...")
5254
for _, item in ipairs(items) do
5355
local root = get_root_for_item(item)
5456
if root then
@@ -65,6 +67,7 @@ M.mark_ignored = function(state, items)
6567
for _, item in ipairs(repo_items) do
6668
table.insert(cmd, item)
6769
end
70+
log.trace("IGNORED: Running cmd: ", cmd)
6871
local result = vim.fn.systemlist(cmd)
6972
if vim.v.shell_error == 128 then
7073
if type(result) == "table" then
@@ -80,6 +83,7 @@ M.mark_ignored = function(state, items)
8083

8184
--check-ignore does not indicate directories the same as 'status' so we need to
8285
--add the trailing slash to the path manually.
86+
log.trace("IGNORED: Checking types of", #result, "items to see which ones are directories")
8387
for i, item in ipairs(result) do
8488
local stat = vim.loop.fs_stat(item)
8589
if stat and stat.type == "directory" then
@@ -89,14 +93,19 @@ M.mark_ignored = function(state, items)
8993
vim.list_extend(all_results, result)
9094
end
9195

92-
96+
log.trace("IGNORED: Comparing results to mark items as ignored")
97+
local ignored, not_ignored = 0, 0
9398
for _, item in ipairs(items) do
9499
if M.is_ignored(all_results, item.path, item.type) then
95100
item.filtered_by = item.filtered_by or {}
96101
item.filtered_by.gitignored = true
102+
ignored = ignored + 1
103+
else
104+
not_ignored = not_ignored + 1
97105
end
98106
end
99-
107+
log.trace("IGNORED: mark_ignored is complete, ignored:", ignored, ", not ignored:", not_ignored)
108+
log.trace("================================================================================")
100109
return all_results
101110
end
102111

lua/neo-tree/git/utils.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ M.get_repository_root = function(path)
1919
git_root = utils.windowize_path(git_root)
2020
end
2121

22-
log.trace("GIT ROOT is ", git_root)
22+
log.trace("GIT ROOT for '", path, "' is '", git_root, "'")
2323
return git_root
2424
end
2525

0 commit comments

Comments
 (0)