diff options
| author | Bozhidar Batsov <bozhidar@batsov.dev> | 2026-02-13 12:33:18 +0200 |
|---|---|---|
| committer | Bozhidar Batsov <bozhidar@batsov.dev> | 2026-02-13 12:33:18 +0200 |
| commit | 3c287cd1b4a5289e6342361471c11685e3f168ab (patch) | |
| tree | fd0c461d136ec3e9fadd14b071fe73a2c4f7faa4 /projectile.el | |
| parent | ca324b78471201dca4a7b1dc41ab7b716b1cc1c9 (diff) | |
Prevent directories from matching file-type project root markers
On case-insensitive filesystems (macOS default), a ~/workspace directory
matches the "WORKSPACE" Bazel marker because file-exists-p returns t for
both files and directories. This causes the home directory to be falsely
detected as a Bazel project root, leading to severe performance issues.
Add a (not (file-directory-p ...)) guard in projectile-root-top-down so
that only regular files can satisfy file-type marker checks.
Fixes #1961
Diffstat (limited to 'projectile.el')
| -rw-r--r-- | projectile.el | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/projectile.el b/projectile.el index eed377a..7f0c581 100644 --- a/projectile.el +++ b/projectile.el @@ -1325,7 +1325,10 @@ Return the first (topmost) matched directory or nil if not found." (projectile-locate-dominating-file dir (lambda (dir) - (cl-find-if (lambda (f) (projectile-file-exists-p (projectile-expand-file-name-wildcard f dir))) + (cl-find-if (lambda (f) + (let ((expanded (projectile-expand-file-name-wildcard f dir))) + (and (projectile-file-exists-p expanded) + (not (file-directory-p expanded))))) (or list projectile-project-root-files))))) (defun projectile-root-marked (dir) |
