Function: projectile--alien-exclude-glob
projectile--alien-exclude-glob is a byte-compiled function defined in
projectile.el.
Signature
(projectile--alien-exclude-glob GLOB STYLE)
Documentation
Translate GLOB into an exclusion pattern of the given STYLE.
GLOB is an entry as produced by projectile--project-ignore-globs, i.e.
a gitignore pattern: any slash other than a trailing one anchors it at
the project root, a trailing / means it names a directory (so its
whole subtree is excluded), and a pattern without a slash matches at any
depth.
STYLE is git for a git ls-files pathspec body (wildmatch semantics,
where ** crosses directory separators) or fd for an fd --exclude
pattern (gitignore semantics, where a leading / anchors to the search
root).
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--alien-exclude-glob (glob style)
"Translate GLOB into an exclusion pattern of the given STYLE.
GLOB is an entry as produced by `projectile--project-ignore-globs', i.e.
a gitignore pattern: any slash other than a trailing one anchors it at
the project root, a trailing `/' means it names a directory (so its
whole subtree is excluded), and a pattern without a slash matches at any
depth.
STYLE is `git' for a `git ls-files' pathspec body (wildmatch semantics,
where `**' crosses directory separators) or `fd' for an `fd --exclude'
pattern (gitignore semantics, where a leading `/' anchors to the search
root)."
(let* ((dirp (string-suffix-p "/" glob))
(body (if dirp (substring glob 0 -1) glob))
(rooted (string-search "/" body))
(body (string-remove-prefix "/" body)))
(pcase style
;; A pathspec is anchored at the pathspec root already, so an
;; any-depth pattern is the one that needs the `**/' prefix.
('git (concat (unless rooted "**/") body (when dirp "/**")))
('fd (concat (when rooted "/") body (when dirp "/")))
(_ (error "Unknown exclusion style `%S'" style)))))