aboutsummaryrefslogtreecommitdiff
path: root/projectile.el
diff options
context:
space:
mode:
authorRadon Rosborough <radon@intuitiveexplanations.com>2023-03-11 21:40:53 -0800
committerGitHub <noreply@github.com>2023-03-12 07:40:53 +0200
commit6dc58831a2c8bc6e036d9dc6549e2cda455dbf27 (patch)
tree8e7a2c0c9b5670659d8eb17fdb14a7f45af0eaeb /projectile.el
parent76475745fb408fa716b2b43c436ba07a56836f89 (diff)
[#1148] Don't show deleted files in listing (#1825)
When fd is installed, use it with appropriate options instead of git ls-files in order to fix https://github.com/bbatsov/projectile/issues/1148
Diffstat (limited to 'projectile.el')
-rw-r--r--projectile.el32
1 files changed, 31 insertions, 1 deletions
diff --git a/projectile.el b/projectile.el
index 9d67f14..c11ca6b 100644
--- a/projectile.el
+++ b/projectile.el
@@ -672,11 +672,36 @@ means check all the subdirectories of DIRECTORY. Etc."
:type '(repeat (choice directory (cons directory (integer :tag "Depth"))))
:package-version '(projectile . "1.0.0"))
+(defcustom projectile-fd-executable
+ (cond
+ ((executable-find "fdfind") "fdfind")
+ ((executable-find "fd") "fd"))
+ "Path or name of fd executable used by Projectile if enabled.
+Nil means fd is not installed or should not be used."
+ :type 'string)
+
+(defcustom projectile-git-use-fd (when projectile-fd-executable t)
+ "Non-nil means use fd to implement git ls-files.
+This may change Projectile's performance in large Git repositories
+depending on your system, but it will also work around the Git behavior
+that causes deleted files to still be shown in Projectile listings until
+their deletions are staged."
+ :type 'boolean
+ :package-version '(projectile . "2.8.0"))
+
(defcustom projectile-git-command "git ls-files -zco --exclude-standard"
"Command used by projectile to get the files in a git project."
:group 'projectile
:type 'string)
+(defcustom projectile-git-fd-args "-H -0 -E .git -tf --strip-cwd-prefix"
+ "Arguments to fd used to re-implement `git ls-files'.
+This is used with `projectile-fd-executable' when `projectile-git-use-fd'
+is non-nil."
+ :group 'projectile
+ :type 'string
+ :package-version '(projectile . "2.8.0"))
+
(defcustom projectile-git-submodule-command "git submodule --quiet foreach 'echo $displaypath' | tr '\\n' '\\0'"
"Command used by projectile to list submodules of a given git repository.
Set to nil to disable listing submodules contents."
@@ -1422,7 +1447,12 @@ IGNORED-DIRECTORIES may optionally be provided."
"Determine which external command to invoke based on the project's VCS.
Fallback to a generic command when not in a VCS-controlled project."
(pcase vcs
- ('git projectile-git-command)
+ ('git (if (and projectile-git-use-fd projectile-fd-executable)
+ (concat
+ projectile-fd-executable
+ " "
+ projectile-git-fd-args)
+ projectile-git-command))
('hg projectile-hg-command)
('fossil projectile-fossil-command)
('bzr projectile-bzr-command)