Skip to content

Final indexing review batch: cleanup, tests, docs#2000

Merged
bbatsov merged 3 commits intomasterfrom
indexing-cleanup-final
Apr 26, 2026
Merged

Final indexing review batch: cleanup, tests, docs#2000
bbatsov merged 3 commits intomasterfrom
indexing-cleanup-final

Conversation

@bbatsov
Copy link
Copy Markdown
Owner

@bbatsov bbatsov commented Apr 26, 2026

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)

  • Skip the git submodule foreach shell-out for git projects without a .gitmodules file anywhere up the parent chain. Hot path for monorepos that re-index the project root often. locate-dominating-file covers the case where PATH is inside a git repo but not its toplevel.
  • 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.

Tests (#366049b)

  • projectile-get-ext-command had 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. New describe block pins each branch.
  • Two projectile-dir-files-alien cases that were previously uncovered: the fd path for git (also verifying we skip projectile-git-deleted-files) and the no-VCS fallback (verifying the generic command is used).

Docs (#a039e44)

  • Document the * prefix semantics for projectile-globally-ignored-directories (it's not a glob; promotes basename match from anchored-at-root to anywhere; only matters under hybrid).
  • Show both default forms of projectile-generic-command (fd-when-present vs the find fallback) and warn about the find fallback's lack of common-directory exclusions.
  • Document how projectile-git-use-fd interacts with deleted-but-unstaged files.

305 specs pass locally (6 new).

bbatsov added 3 commits April 26, 2026 12:29
`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'.
@bbatsov bbatsov merged commit 67c18e2 into master Apr 26, 2026
10 checks passed
@bbatsov bbatsov deleted the indexing-cleanup-final branch April 26, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant