Final indexing review batch: cleanup, tests, docs#2000
Merged
Conversation
`projectile-get-immediate-sub-projects' was unconditionally shelling out to `git submodule --quiet foreach ...' on every indexing call for git projects, even when the project had no submodules at all. For monorepos that re-index the project root often this is pure overhead. Use `locate-dominating-file' to look for `.gitmodules' along the parent chain (PATH may be inside a git repo without being its toplevel) and skip the shell-out when none is found. Also tighten `projectile-discover-projects-in-directory' to filter `.' / `..' via `directory-files-no-dot-files-regexp' instead of a post-filter `member' check, matching the indexing walker's style.
`projectile-get-ext-command' had no direct test coverage, so the non-git VCS branches (hg/svn/bzr/darcs/fossil/pijul/sapling/jj) were relying on indirect coverage that didn't actually exercise the dispatch. Add a `describe' block that pins each branch. Also extend the `projectile-dir-files-alien' tests with two cases that were previously uncovered: the fd path for git (verifying we don't also call `projectile-git-deleted-files') and the no-VCS fallback (verifying the generic command is used).
Three doc gaps surfaced during the indexing review: * The `*' prefix on `projectile-globally-ignored-directories' entries is not a glob - it is what promotes a basename match from "anchored at the project root" to "anywhere in the tree", and it only takes effect under hybrid indexing. * The default `projectile-generic-command' picks `fd' when it's on PATH and falls back to a `find ... | tr ...' pipeline. The fallback does not exclude common build directories, which is a trap for non-VCS projects under alien on hosts without `fd'. * `projectile-git-use-fd' controls how Projectile handles deleted-but-unstaged files: with `fd' they disappear immediately, with `git ls-files' Projectile post-filters via `git ls-files -zd'.
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.
Closing out the indexing-strategies review. Three independent improvements from the original report that didn't naturally fit into the earlier perf-focused PRs:
Code (#ccd8052)
git submodule foreachshell-out for git projects without a.gitmodulesfile anywhere up the parent chain. Hot path for monorepos that re-index the project root often.locate-dominating-filecovers the case where PATH is inside a git repo but not its toplevel.projectile-discover-projects-in-directoryto filter./..viadirectory-files-no-dot-files-regexpinstead of a post-filtermembercheck, matching the indexing walker's style.Tests (#366049b)
projectile-get-ext-commandhad no direct coverage — the non-git VCS branches (hg/svn/bzr/darcs/fossil/pijul/sapling/jj) all relied on indirect coverage that didn't actually exercise the dispatch. Newdescribeblock pins each branch.projectile-dir-files-aliencases that were previously uncovered: the fd path for git (also verifying we skipprojectile-git-deleted-files) and the no-VCS fallback (verifying the generic command is used).Docs (#a039e44)
*prefix semantics forprojectile-globally-ignored-directories(it's not a glob; promotes basename match from anchored-at-root to anywhere; only matters under hybrid).projectile-generic-command(fd-when-present vs the find fallback) and warn about the find fallback's lack of common-directory exclusions.projectile-git-use-fdinteracts with deleted-but-unstaged files.305 specs pass locally (6 new).