Repository navigation
fix(git): handle nested worktrees properly - #2015
Merged
Merged
Conversation
pynappo
force-pushed
the
fix/git-nested-worktree
branch
from
April 16, 2026 07:50
487f530 to
88f394f
Compare
3 tasks done
pynappo
added a commit
to stupidbullet/neo-tree.nvim
that referenced
this pull request
May 20, 2026
3 tasks done
pynappo
pushed a commit
to ardaaltinors/neo-tree.nvim
that referenced
this pull request
Aug 18, 2026
Nested repository discovery in `on_directory_loaded` lived inside the `if state.use_libuv_file_watcher then` branch, so a folder holding a `.git` entry was only registered as its own worktree when the file watcher was enabled. `use_libuv_file_watcher` defaults to `false`, so under the default config a nested repository was never discovered: every path below it resolved against the outer worktree, and its files were reported as ignored whenever the outer `.gitignore` excludes the directory. This completes nvim-neo-tree#2015 for the default config. Registration now sits outside the watcher branch and is gated on `enable_git_status`. Two details keep it from adding work for anyone else: - The tree root is skipped, because the source already runs a status for it in `filesystem.navigate`. Without this it would be statused twice on every fresh scan, which is measurable on large repositories. The guard compares `folder.path` rather than `target_path` so that a symlinked tree root is still recognised as the root. - The child has to be named exactly `.git` rather than merely end in `.git`, so directories such as `mirror.git` no longer trigger a `git rev-parse` on every scan. Those never become registered worktrees, so the existing lookup guard cannot suppress the repeat. Because the block now precedes the watcher's early return for git-internal paths, discovery also runs for folders inside a `.git` directory. That is inert: such folders do not contain a `.git` child.
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2010
Also various refactors of the codebase