From 078e563355143d2ad0d6fb97bd2140dd29b2314b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 13 Dec 2019 17:28:33 -0500 Subject: [PATCH] Prevent duplicates in projectile file lists Projectile has `projectile-git-command` and `projectile-git-submodule-command`. By default, these use `git ls-files` and `git submodule foreach 'echo $path'`, respectively. It uses them together to index a full list of project files. Since we've changed `projectile-git-command` to use `fd` or `ripgrep`, which indexes submodules just fine (unlike git ls-files), you get duplicates when projectile does a second pass with `projectile-git-submodule-command`, so we unset it completely. --- core/core-projects.el | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/core/core-projects.el b/core/core-projects.el index fad112f82..c24e587e4 100644 --- a/core/core-projects.el +++ b/core/core-projects.el @@ -123,10 +123,11 @@ c) are not valid projectile projects." ;; that is significantly faster than git ls-files or find, and it respects ;; .gitignore. This is recommended in the projectile docs. ((executable-find doom-projectile-fd-binary) - (setq projectile-git-command (concat - doom-projectile-fd-binary - " . --color=never --type f -0 -H -E .git") - projectile-generic-command projectile-git-command + (setq projectile-generic-command + (format "%s . --color=never --type f -0 -H -E .git" + doom-projectile-fd-binary) + projectile-git-command projectile-generic-command + projectile-git-submodule-command nil ;; ensure Windows users get fd's benefits projectile-indexing-method 'alien)) @@ -136,12 +137,13 @@ c) are not valid projectile projects." (concat "rg -0 --files --color=never --hidden" (cl-loop for dir in projectile-globally-ignored-directories concat (format " --glob '!%s'" dir))) + projectile-git-command projectile-generic-command + projectile-git-submodule-command nil ;; ensure Windows users get rg's benefits - projectile-indexing-method 'alien) - ;; fix breakage on windows in git projects - (unless (executable-find "tr") - (setq projectile-git-submodule-command nil))) + projectile-indexing-method 'alien)) + ;; Fix breakage on windows in git projects with submodules, since Windows + ;; doesn't have tr ((not (executable-find "tr")) (setq projectile-git-submodule-command nil)))