Function: projectile--grep-find-path-tests

projectile--grep-find-path-tests is a byte-compiled function defined in projectile.el.

Signature

(projectile--grep-find-path-tests ANCHORED FLOATING)

Documentation

Return find -path tests matching the ANCHORED and FLOATING patterns.

An anchored pattern is spelled ./PATH, so it only matches from the directory find was started in; a floating one gets a */ prefix, so it matches at any depth. Return nil when both lists are empty.

The one place this can't be exact is that * in a find -path glob crosses /, where a gitignore * stays within a path segment, so an anchored pattern like /*.txt also prunes deeper matches here.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--grep-find-path-tests (anchored floating)
  "Return `find' -path tests matching the ANCHORED and FLOATING patterns.
An anchored pattern is spelled `./PATH', so it only matches from the
directory `find' was started in; a floating one gets a `*/' prefix, so it
matches at any depth.  Return nil when both lists are empty.

The one place this can't be exact is that `*' in a `find' -path glob
crosses `/', where a gitignore `*' stays within a path segment, so an
anchored pattern like `/*.txt' also prunes deeper matches here."
  (when-let* ((globs (append
                      (mapcar (lambda (pattern) (concat "./" pattern)) anchored)
                      (mapcar (lambda (pattern)
                                (if (string-prefix-p "*" pattern)
                                    pattern
                                  (concat "*/" pattern)))
                              floating))))
    (concat " -path " (mapconcat #'shell-quote-argument globs " -o -path "))))