Skip to content

Commit 50461b6

Browse files
committed
fix(git): remove git_status_source option, only use check-ignore, fixes #193
1 parent 9913b0d commit 50461b6

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

lua/neo-tree/defaults.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ local config = {
189189
--".DS_Store",
190190
--"thumbs.db"
191191
},
192-
gitignore_source = "git check-ignored", -- or "git status", which may be faster in some repos
193192
},
194193
find_by_full_path_words = false, -- `false` means it only searches the tail of a path.
195194
-- `true` will change the filter into a full path

lua/neo-tree/setup/deprecations.lua

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ M.migrate = function (config)
4141
end
4242
end
4343

44+
local removed = function(key)
45+
local value = utils.get_value(config, key)
46+
if type(value) ~= "nil" then
47+
utils.set_value(config, key, nil)
48+
migrations[#migrations + 1] = string.format("The `%s` option has been removed.", key)
49+
end
50+
end
51+
4452
local renamed_value = function(key, old_value, new_value)
4553
local value = utils.get_value(config, key)
4654
if value == old_value then
@@ -56,7 +64,8 @@ M.migrate = function (config)
5664
moved("filesystem.filters", "filesystem.filtered_items")
5765
moved("filesystem.filters.show_hidden", "filesystem.filtered_items.hide_dotfiles", opposite)
5866
moved("filesystem.filters.respect_gitignore", "filesystem.filtered_items.hide_gitignored")
59-
moved("filesystem.filters.gitignore_source", "filesystem.filtered_items.gitignore_source")
67+
removed("filesystem.filters.gitignore_source")
68+
removed("filesystem.filter_items.gitignore_source")
6069
renamed_value("filesystem.hijack_netrw_behavior", "open_split", "open_current")
6170
for _, source in ipairs({"filesystem", "buffers", "git_status"}) do
6271
renamed_value(source .. "window.position", "split", "current")

lua/neo-tree/sources/filesystem/lib/fs_scan.lua

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,16 @@ M.get_items_async = function(state, parent_id, path_to_reveal, callback)
152152
local f = state.filtered_items or {}
153153
local ignored = {}
154154
if f.hide_gitignored then
155-
if f.gitignore_source == "git status" then
156-
ignored = git.load_ignored(state.path)
157-
elseif f.gitignore_source == "git check-ignore" then
158-
ignored = git.load_ignored_per_directory(state.path)
159-
for _, p in ipairs(context.paths_to_load) do
160-
vim.list_extend(ignored, git.load_ignored_per_directory(p))
161-
end
155+
ignored = git.load_ignored_per_directory(state.path)
156+
for _, p in ipairs(context.paths_to_load) do
157+
vim.list_extend(ignored, git.load_ignored_per_directory(p))
162158
end
163159
end
164160
state.git_ignored = ignored
165161
else
166162
-- just update the ignored list for this dir if we are using the per dir 'check-ignore' option
167163
local f = state.filtered_items or {}
168-
if f.hide_gitignored and f.gitignore_source == "git check-ignore" then
164+
if f.hide_gitignored then
169165
state.git_ignored = state.git_ignored or {}
170166
vim.list_extend(state.git_ignored, git.load_ignored_per_directory(parent_id))
171167
end

lua/neo-tree/ui/highlights.lua

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,6 @@ M.setup = function()
107107
create_highlight_group(M.FLOAT_TITLE, {}, float_border_hl.background, normal_hl.foreground)
108108
create_highlight_group(M.TITLE_BAR, {}, float_border_hl.foreground, nil)
109109

110-
local added = create_highlight_group(
111-
M.GIT_ADDED,
112-
{ "GitGutterAdd", "GitSignsAdd" },
113-
nil,
114-
"5faf5f"
115-
)
116-
create_highlight_group(M.GIT_DELETED, { "GitGutterDelete", "GitSignsDelete" }, nil, "ff5900")
117-
create_highlight_group(M.GIT_MODIFIED, { "GitGutterChange", "GitSignsChange" }, nil, "d7af5f")
118-
local conflict = create_highlight_group(M.GIT_CONFLICT, {}, nil, "ff8700", "italic,bold")
119-
create_highlight_group(M.GIT_IGNORED, { M.DOTFILE }, nil, nil)
120-
create_highlight_group(M.GIT_RENAMED, { M.GIT_MODIFIED }, nil, nil)
121-
create_highlight_group(M.GIT_UNTRACKED, {}, nil, conflict.foreground, "italic")
122-
123110
create_highlight_group(M.BUFFER_NUMBER, { "SpecialChar" })
124111
create_highlight_group(M.DIM_TEXT, {}, nil, "505050")
125112
create_highlight_group(M.DOTFILE, {}, nil, "626262")
@@ -135,6 +122,19 @@ M.setup = function()
135122
create_highlight_group(M.ROOT_NAME, {}, nil, nil, "bold,italic")
136123
create_highlight_group(M.INDENT_MARKER, { M.DIM_TEXT })
137124
create_highlight_group(M.EXPANDER, { M.DIM_TEXT })
125+
126+
local added = create_highlight_group(
127+
M.GIT_ADDED,
128+
{ "GitGutterAdd", "GitSignsAdd" },
129+
nil,
130+
"5faf5f"
131+
)
132+
create_highlight_group(M.GIT_DELETED, { "GitGutterDelete", "GitSignsDelete" }, nil, "ff5900")
133+
create_highlight_group(M.GIT_MODIFIED, { "GitGutterChange", "GitSignsChange" }, nil, "d7af5f")
134+
local conflict = create_highlight_group(M.GIT_CONFLICT, {}, nil, "ff8700", "italic,bold")
135+
create_highlight_group(M.GIT_IGNORED, { M.DOTFILE }, nil, nil)
136+
create_highlight_group(M.GIT_RENAMED, { M.GIT_MODIFIED }, nil, nil)
137+
create_highlight_group(M.GIT_UNTRACKED, {}, nil, conflict.foreground, "italic")
138138
end
139139

140140
return M

0 commit comments

Comments
 (0)