emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/projectile 6dc58831a2: [#1148] Don't show deleted files in


From: ELPA Syncer
Subject: [nongnu] elpa/projectile 6dc58831a2: [#1148] Don't show deleted files in listing (#1825)
Date: Sun, 12 Mar 2023 01:02:21 -0500 (EST)

branch: elpa/projectile
commit 6dc58831a2c8bc6e036d9dc6549e2cda455dbf27
Author: Radon Rosborough <radon@intuitiveexplanations.com>
Commit: GitHub <noreply@github.com>

    [#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
---
 CHANGELOG.md                      |  4 ++++
 README.md                         |  1 +
 doc/modules/ROOT/pages/faq.adoc   | 21 +++++++++++++++++++++
 doc/modules/ROOT/pages/usage.adoc | 29 +++++++++++++++++++++++------
 projectile.el                     | 32 +++++++++++++++++++++++++++++++-
 5 files changed, 80 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 214119c2d5..7571288225 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,10 @@
 * Add elm project type.
 * [#1821](https://github.com/bbatsov/projectile/pull/1821): Add 
`pyproject.toml` discovery for python projects.
 
+### Changes
+
+* [#1285](https://github.com/bbatsov/projectile/pull/1825): By default, use 
[fd](https://github.com/sharkdp/fd) in Git repositories instead of `git 
ls-files` when it is installed, in order to solve the problem where deleted 
files were still shown in `projectile-find-file` until their deletions were 
staged. The user-facing behavior should be the same, although potentially with 
different performance characteristics in large Git repositories. The old 
behavior can be reclaimed by setting `pr [...]
+
 ## 2.7.0 (2022-11-22)
 
 ### New features
diff --git a/README.md b/README.md
index c60b800032..c4b8d0436c 100644
--- a/README.md
+++ b/README.md
@@ -125,6 +125,7 @@ To get the most of Projectile you also need to enable (and 
potentially install)
 * Using Projectile over TRAMP might be slow in certain cases.
 * Some commands might misbehave on complex project setups (e.g. a git project 
with submodules).
 * Projectile was mostly tested on Unix OS-es (e.g. GNU/Linux and macOS), so 
some functionality might not work well on Windows.
+* In Git repositories, deleted files are still shown in `projectile-find-file` 
until their deletions are staged, due to a limitation of `git ls-files`. If you 
install [fd](https://github.com/sharkdp/fd) then it is automatically used 
instead, and does not have this problem. (You can inhibit the use of `fd` by 
setting `projectile-git-use-fd` to nil.)
 
 ## Known issues
 
diff --git a/doc/modules/ROOT/pages/faq.adoc b/doc/modules/ROOT/pages/faq.adoc
index 55d098eb20..62166c8b37 100644
--- a/doc/modules/ROOT/pages/faq.adoc
+++ b/doc/modules/ROOT/pages/faq.adoc
@@ -51,6 +51,27 @@ super convenient for many people.
 Eventually this was changed in Projectile 2.0. That's why currently Projectile
 requires users to select a prefix key for its commands explicitly.
 
+== What dependencies does Projectile have?
+
+Projectile will work without any external dependencies out of the box.
+However, if you have various tools installed, they will be
+automatically used when appropriate to improve performance.
+
+Inside version control repositories, VC tools are used when installed
+to list files more efficiently. The supported tools include git, hg,
+fossil, bzr, darcs, pijul, and svn.
+
+Outside version control repositories, file search tools are used when
+installed for a faster search than pure Elisp. The supported tools
+include https://github.com/sharkdp/fd[fd] and GNU/BSD find.
+
+By default, if fd is installed, it is also used inside Git
+repositories as an alternative to `git ls-files`, because `git
+ls-files` has the limitation that it also lists deleted files until
+the deletions are staged, which can be confusing. You can eliminate
+the use of fd in this circumstance by setting `projectile-git-use-fd`
+to nil.
+
 == Do you need some help cleanup up all those tickets that have piled up?
 
 Certainly! In our https://github.com/bbatsov/projectile/issues/[issue
diff --git a/doc/modules/ROOT/pages/usage.adoc 
b/doc/modules/ROOT/pages/usage.adoc
index 65db060f6a..8333d6c3df 100644
--- a/doc/modules/ROOT/pages/usage.adoc
+++ b/doc/modules/ROOT/pages/usage.adoc
@@ -46,12 +46,29 @@ a good idea to enable `prescient` (a package similar to 
`flx`).
 
 NOTE: Windows users can ignore this section unless they are using Emacs via 
WSL or `cygwin`.
 
-It's recommended to install the following command-line tools:
-
-* `fd` (a super-fast alternative to `find`)
-* `ag` (a.k.a. `the_silver_searcher`, a powerful alternative to `grep`) or 
`rg` (a.k.a. `ripgrep`)
-
-Projectile will make use of them automatically when available, and fallback to 
the standard Unix tools otherwise.
+Projectile will work without any external dependencies out of the box.
+However, if you have various tools installed, they will be
+automatically used when appropriate to improve performance.
+
+Inside version control repositories, VC tools are used when installed
+to list files more efficiently. The supported tools include git, hg,
+fossil, bzr, darcs, pijul, and svn.
+
+Outside version control repositories, file search tools are used when
+installed for a faster search than pure Elisp. The supported tools
+include https://github.com/sharkdp/fd[fd] and GNU/BSD find.
+
+By default, if fd is installed, it is also used inside Git
+repositories as an alternative to `git ls-files`, because `git
+ls-files` has the limitation that it also lists deleted files until
+the deletions are staged, which can be confusing. You can eliminate
+the use of fd in this circumstance by setting `projectile-git-use-fd`
+to nil.
+
+To benefit from the `projectile-ag` and `projectile-ripgrep` commands
+to perform file search, it's recommended to install
+https://github.com/ggreer/the_silver_searcher[ag] (`the_silver_searcher`) 
and/or
+https://github.com/BurntSushi/ripgrep[rg] (`ripgrep`)
 
 TIP: You should also install the Emacs packages `ag`, `ripgrep` or `rg` if you 
want to make sure of Projectile's commands `projectile-ag` and 
`projectile-ripgrep`.
 
diff --git a/projectile.el b/projectile.el
index 9d67f14f9b..c11ca6b4db 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]