Submodule-aware watcher and git status optimization#120
Merged
actionshrimp merged 3 commits intomainfrom Feb 28, 2026
Merged
Conversation
The recursive worktree watcher reports nested paths like "build/output.o", but the gitignore cache only stores top-level entries like "build". This caused all nested file events in gitignored directories to bypass the cache filter, triggering unnecessary stale indicators. Changes: - Extract first path component from nested paths before checking cache - Fix .git skip to also catch nested .git/ paths (e.g., .git/objects) - Add _is_gitignored() method with unit tests for top-level, nested, prefix-similar, and empty cache scenarios
In repos with many submodules, build activity and IDE indexing inside submodule directories triggers constant watcher events, causing the stale indicator to flash repeatedly. This routes submodule file events through a separate debouncer with a longer timeout (default 5000ms), so submodule churn doesn't interfere with normal workflow responsiveness. Changes: - Parse .gitmodules at watcher start to build submodule path cache - Add _is_submodule_path() to detect files within submodule directories - Route submodule events to _handle_submodule_event() with separate debouncer - Rebuild submodule cache when .gitmodules changes - Add submodule_debounce_ms config option (default 5000ms) - Pass config through status.lua to watcher constructor
2124134 to
126ba0b
Compare
In repos with many submodules, `git status` recursively checks each
submodule's working tree, which can be very slow. This adds a config
option to pass --ignore-submodules to git status.
Usage:
require("gitlad").setup({
git = { ignore_submodules = "dirty" }
})
Values: false (default), "dirty", "untracked", "all"
With "dirty", submodules with only working tree changes are hidden from
status while submodules with changed HEAD commit remain visible. The
submodules section (via `git submodule status`) is unaffected.
126ba0b to
5ad6d66
Compare
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.
Summary
build/output.o, but the cache only stores top-level entries likebuild. Now extracts the first path component before checking the cache. Also fixes.gitskip for nested.git/paths..gitmodulesat watcher start to build a submodule path cache, then routes submodule file events through a separate debouncer with a longer timeout (default 5s vs 200ms). Prevents build activity and IDE indexing in submodule directories from causing constant stale indicator churn.git.ignore_submodulesconfig option — passes--ignore-submodulestogit status, making refreshes dramatically faster in repos with many submodules. Supportsfalse(default),"dirty","untracked", and"all".Test plan
_is_gitignored,_is_submodule_path, and submodule debouncer--ignore-submodulesbehaviorgit = { ignore_submodules = "dirty" }, verify fast status and reduced watcher churn