diff options
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | projectile.el | 6 | ||||
| -rw-r--r-- | test/projectile-test.el | 6 |
3 files changed, 11 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f0ac7a..2af852c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Bugs fixed * [#1961](https://github.com/bbatsov/projectile/issues/1961): Prevent directories from matching file-type project root markers (e.g., a `workspace` directory no longer matches the `WORKSPACE` Bazel marker on case-insensitive filesystems). +* [#1749](https://github.com/bbatsov/projectile/issues/1749): Strip `./` prefix from `fd` output in `projectile-files-via-ext-command`, fixing compatibility with older `fd` versions that don't support `--strip-cwd-prefix`. ### Changes diff --git a/projectile.el b/projectile.el index 7f0c581..90e2d48 100644 --- a/projectile.el +++ b/projectile.el @@ -1661,7 +1661,11 @@ Only text sent to standard output is taken into account." (with-temp-buffer (shell-command command t "*projectile-files-errors*") (let ((shell-output (buffer-substring (point-min) (point-max)))) - (split-string (string-trim shell-output) "\0" t)))))) + (mapcar (lambda (f) + (if (string-prefix-p "./" f) + (substring f 2) + f)) + (split-string (string-trim shell-output) "\0" t))))))) (defun projectile-adjust-files (project vcs files) "First remove ignored files from FILES, then add back unignored files." diff --git a/test/projectile-test.el b/test/projectile-test.el index 33c50e4..0880d6d 100644 --- a/test/projectile-test.el +++ b/test/projectile-test.el @@ -546,7 +546,11 @@ Just delegates OPERATION and ARGS for all operations except for`shell-command`'. (expect (projectile-files-via-ext-command "" "echo filename") :to-equal '("filename"))) (it "supports magic file handlers" - (expect (projectile-files-via-ext-command "#magic#" "echo filename") :to-equal '("magic")))) + (expect (projectile-files-via-ext-command "#magic#" "echo filename") :to-equal '("magic"))) + + (it "strips ./ prefix from results" + (expect (projectile-files-via-ext-command "" "printf './foo\\0./bar/baz\\0quux'") + :to-equal '("foo" "bar/baz" "quux")))) (describe "projectile-mode" (before-each |
