nvim-tree / nvim-tree/nvim-tree.lua
Application slow closing directories with .git contained
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 8.6k
- Forks
- 639
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
Description
After upgrading to 0.10.*, closing nvim causes a long pause, up to 10 seconds.
This seems to be similar to #2438, but it is replicable with zero changes made to the cleanroom config, and is not related to node_modules or any similar large directory.
This is replicable using the absolute barebones cleanroom config without any changes made.
There appears to be no relevant info in nvim-tree.log as all logged lines occurs before the attempted close.
This behaviour has two interesting cases
- If any subdirectories of the open path contains a
.gitdirectory, the bug occurs, it does not only apply to the root open path - The issue also persists if a
.gitdirectory simply exists without being an actual git repo
Neovim version
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1727870382
git version 2.47.0
Operating system and version
MacOS 14.1
Windows variant
No response
nvim-tree version
c763948
Clean room replication
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvt-min/site]])
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
require("packer").startup({
{
"wbthomason/packer.nvim",
"nvim-tree/nvim-tree.lua",
"nvim-tree/nvim-web-devicons",
-- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
},
config = {
package_root = package_root,
compile_path = install_path .. "/plugin/packer_compiled.lua",
display = { non_interactive = true },
},
})
end
if vim.fn.isdirectory(install_path) == 0 then
print("Installing nvim-tree and dependencies.")
vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path })
end
load_plugins()
require("packer").sync()
vim.cmd([[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]])
vim.opt.termguicolors = true
vim.opt.cursorline = true
-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
require("nvim-tree").setup({
log = {
enable = true,
truncate = true,
types = {
all = false,
config = false,
copy_paste = false,
dev = false,
diagnostics = true,
git = true,
profile = true,
watcher = true,
},
},
})
end
-- UNCOMMENT this block for diagnostics issues, substituting pattern and cmd as appropriate.
-- Requires diagnostics.enable = true in setup.
--[[
vim.api.nvim_create_autocmd("FileType", {
pattern = "lua",
callback = function()
vim.lsp.start {
name = "my-luals",
cmd = { "lua-language-server" },
root_dir = vim.loop.cwd(),
}
end,
})
]]
Steps to reproduce
- Create a new directory to test in
- Initialize a git repo in the directory, or create an empty .git directory within
- Open directory with cleanroom configuration
- Toggle the visibility of the tree
- Close the project
Expected behavior
Standard close behavior.
Actual behavior
A hang/delay of up to 10 seconds before nvim closes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the delay with the minimal cleanroom configuration and the listed steps, using an empty .git directory and an initialized repository. Start by reviewing the nvim-tree setup and nvim-tree.log around closing, then compare behavior with and without nested .git directories. Done means closing the project returns to standard behavior without the multi-second pause.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, lua
- Domain
- performance, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100