aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.dev>2026-02-13 13:35:13 +0200
committerBozhidar Batsov <bozhidar@batsov.dev>2026-02-13 13:35:13 +0200
commit5560f083b69d40eb1a0e359fdd4ba9712f8a1bd8 (patch)
treea01d10fe4fec5c2034478549fbeea41a8d05dd6d /test
parentac37c2c96b1296b147aed021273efdd20e3b4938 (diff)
Skip unreadable directories in projectile-index-directory (#1873)
Wrap the directory-files call in ignore-errors so that unreadable directories (e.g. .Spotlight-V100 on macOS) are silently skipped instead of aborting the entire native indexing operation.
Diffstat (limited to 'test')
-rw-r--r--test/projectile-test.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/projectile-test.el b/test/projectile-test.el
index 0880d6d..c658dcd 100644
--- a/test/projectile-test.el
+++ b/test/projectile-test.el
@@ -532,6 +532,25 @@ Just delegates OPERATION and ARGS for all operations except for`shell-command`'.
(let ((projectile-indexing-method 'hybrid))
(expect (projectile-dir-files "/my/root/") :to-equal '("a/b/c" "a/d/e")))))
+(describe "projectile-index-directory"
+ (it "skips unreadable directories"
+ (unless (eq system-type 'windows-nt)
+ (projectile-test-with-sandbox
+ (projectile-test-with-files
+ ("project/"
+ "project/.projectile"
+ "project/readable-file.el"
+ "project/unreadable-dir/")
+ (let* ((project-dir (file-name-as-directory (expand-file-name "project")))
+ (unreadable-dir (expand-file-name "unreadable-dir" project-dir))
+ (progress-reporter (make-progress-reporter "Indexing...")))
+ (set-file-modes unreadable-dir #o000)
+ (unwind-protect
+ (let ((files (projectile-index-directory project-dir nil progress-reporter)))
+ (expect (cl-some (lambda (f) (string-match-p "readable-file" f)) files) :to-be-truthy)
+ (expect (cl-some (lambda (f) (string-match-p "unreadable-dir" f)) files) :not :to-be-truthy))
+ (set-file-modes unreadable-dir #o755))))))))
+
(describe "projectile-get-sub-projects-command"
(it "gets sub projects command for git"
(expect (string-prefix-p "git" (projectile-get-sub-projects-command 'git)) :to-be-truthy))