Skip to content

filtered subfolder Events not torn down #2468

Closed
@alex-courtis

Description

@alex-courtis

Description

Event:destroy not called for subfolders of an ignored folder.

Neovim version

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1696795921

Operating system and version

Linux 6.5.7-arch1-1

nvim-tree version

4054fc4

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 {}
end

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 {}
end

Steps to reproduce

: ; mkdir -p i/1 i/2 i/3
: ; mkdir -p n/1 n/2 n/3
: ; touch i/1/a i/2/a i/3/a
: ; git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
Initialized empty Git repository in /home/alex/src/nvim-tree/r/gitignored.watchers/.git/
: ; echo "i" > .gitignore

Expected behavior

Toggle git ignored filter.
Expand i
Toggle filter again

Watcher:destroy and Event:destroy called for directories under i

Actual behavior

Only Watcher:destroy called for i/[123]. Both are called for i

[2023-10-15 10:27:32] [watcher] Watcher:new '/home/alex/src/nvim-tree/r/gitignored.watchers' nil
[2023-10-15 10:27:32] [watcher] Event:new '/home/alex/src/nvim-tree/r/gitignored.watchers'
[2023-10-15 10:27:32] [watcher] Event:start '/home/alex/src/nvim-tree/r/gitignored.watchers'
[2023-10-15 10:27:32] [watcher] git start
[2023-10-15 10:27:32] [watcher] Watcher:new '/home/alex/src/nvim-tree/r/gitignored.watchers/.git' { "FETCH_HEAD", "HEAD", "HEAD.lock", "config", "index" }
[2023-10-15 10:27:32] [watcher] Event:new '/home/alex/src/nvim-tree/r/gitignored.watchers/.git'
[2023-10-15 10:27:32] [watcher] Event:start '/home/alex/src/nvim-tree/r/gitignored.watchers/.git'
[2023-10-15 10:27:32] [watcher] Watcher:new '/home/alex/src/nvim-tree/r/gitignored.watchers/n' nil
[2023-10-15 10:27:32] [watcher] Event:new '/home/alex/src/nvim-tree/r/gitignored.watchers/n'
[2023-10-15 10:27:32] [watcher] Event:start '/home/alex/src/nvim-tree/r/gitignored.watchers/n'



[2023-10-15 10:27:39] [watcher] Watcher:new '/home/alex/src/nvim-tree/r/gitignored.watchers/n/1' nil
[2023-10-15 10:27:39] [watcher] Event:new '/home/alex/src/nvim-tree/r/gitignored.watchers/n/1'
[2023-10-15 10:27:39] [watcher] Event:start '/home/alex/src/nvim-tree/r/gitignored.watchers/n/1'
[2023-10-15 10:27:39] [watcher] Watcher:new '/home/alex/src/nvim-tree/r/gitignored.watchers/n/2' nil
[2023-10-15 10:27:39] [watcher] Event:new '/home/alex/src/nvim-tree/r/gitignored.watchers/n/2'
[2023-10-15 10:27:39] [watcher] Event:start '/home/alex/src/nvim-tree/r/gitignored.watchers/n/2'
[2023-10-15 10:27:39] [watcher] Watcher:new '/home/alex/src/nvim-tree/r/gitignored.watchers/n/3' nil
[2023-10-15 10:27:39] [watcher] Event:new '/home/alex/src/nvim-tree/r/gitignored.watchers/n/3'
[2023-10-15 10:27:39] [watcher] Event:start '/home/alex/src/nvim-tree/r/gitignored.watchers/n/3'



[2023-10-15 10:27:43] [watcher] Watcher:new '/home/alex/src/nvim-tree/r/gitignored.watchers/i' nil
[2023-10-15 10:27:43] [watcher] Event:new '/home/alex/src/nvim-tree/r/gitignored.watchers/i'
[2023-10-15 10:27:43] [watcher] Event:start '/home/alex/src/nvim-tree/r/gitignored.watchers/i'


[2023-10-15 10:27:47] [watcher] Watcher:new '/home/alex/src/nvim-tree/r/gitignored.watchers/i/1' nil
[2023-10-15 10:27:47] [watcher] Event:new '/home/alex/src/nvim-tree/r/gitignored.watchers/i/1'
[2023-10-15 10:27:47] [watcher] Event:start '/home/alex/src/nvim-tree/r/gitignored.watchers/i/1'
[2023-10-15 10:27:47] [watcher] Watcher:new '/home/alex/src/nvim-tree/r/gitignored.watchers/i/2' nil
[2023-10-15 10:27:47] [watcher] Event:new '/home/alex/src/nvim-tree/r/gitignored.watchers/i/2'
[2023-10-15 10:27:47] [watcher] Event:start '/home/alex/src/nvim-tree/r/gitignored.watchers/i/2'
[2023-10-15 10:27:47] [watcher] Watcher:new '/home/alex/src/nvim-tree/r/gitignored.watchers/i/3' nil
[2023-10-15 10:27:47] [watcher] Event:new '/home/alex/src/nvim-tree/r/gitignored.watchers/i/3'
[2023-10-15 10:27:47] [watcher] Event:start '/home/alex/src/nvim-tree/r/gitignored.watchers/i/3'


[2023-10-15 10:27:53] [watcher] Watcher:destroy '/home/alex/src/nvim-tree/r/gitignored.watchers/i'
[2023-10-15 10:27:53] [watcher] Event:destroy '/home/alex/src/nvim-tree/r/gitignored.watchers/i'

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR pleasenvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciatedbugSomething isn't workingreproducedIssue confirmed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions