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.
This commit is contained in:
Henrik Lissner 2019-12-13 17:28:33 -05:00
parent acdd16f2b1
commit 078e563355
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -123,10 +123,11 @@ c) are not valid projectile projects."
;; that is significantly faster than git ls-files or find, and it respects ;; that is significantly faster than git ls-files or find, and it respects
;; .gitignore. This is recommended in the projectile docs. ;; .gitignore. This is recommended in the projectile docs.
((executable-find doom-projectile-fd-binary) ((executable-find doom-projectile-fd-binary)
(setq projectile-git-command (concat (setq projectile-generic-command
doom-projectile-fd-binary (format "%s . --color=never --type f -0 -H -E .git"
" . --color=never --type f -0 -H -E .git") doom-projectile-fd-binary)
projectile-generic-command projectile-git-command projectile-git-command projectile-generic-command
projectile-git-submodule-command nil
;; ensure Windows users get fd's benefits ;; ensure Windows users get fd's benefits
projectile-indexing-method 'alien)) projectile-indexing-method 'alien))
@ -136,12 +137,13 @@ c) are not valid projectile projects."
(concat "rg -0 --files --color=never --hidden" (concat "rg -0 --files --color=never --hidden"
(cl-loop for dir in projectile-globally-ignored-directories (cl-loop for dir in projectile-globally-ignored-directories
concat (format " --glob '!%s'" dir))) concat (format " --glob '!%s'" dir)))
projectile-git-command projectile-generic-command
projectile-git-submodule-command nil
;; ensure Windows users get rg's benefits ;; ensure Windows users get rg's benefits
projectile-indexing-method 'alien) projectile-indexing-method 'alien))
;; fix breakage on windows in git projects
(unless (executable-find "tr")
(setq projectile-git-submodule-command nil)))
;; Fix breakage on windows in git projects with submodules, since Windows
;; doesn't have tr
((not (executable-find "tr")) ((not (executable-find "tr"))
(setq projectile-git-submodule-command nil))) (setq projectile-git-submodule-command nil)))