Function: magit-todos--scan-with-git-grep

magit-todos--scan-with-git-grep is a natively compiled function defined in magit-todos.el.

Signature

(magit-todos--scan-with-git-grep &key MAGIT-STATUS-BUFFER DIRECTORY DEPTH HEADING SYNC CALLBACK)

Documentation

Scan for to-dos with git-grep.

Then calls CALLBACK. MAGIT-STATUS-BUFFER is what it says. DIRECTORY is the directory in which to run the scan. DEPTH should be an integer, typically the value of magit-todos-depth. HEADING is passed to CALLBACK.

When SYNC is nil, the scanner process is returned, and CALLBACK is a function which is called by the process sentinel with one argument, a list of match items.

When SYNC is non-nil, match items are returned.

Source Code

;; Defined in /nix/store/xy37aj9089qvbs5clw0qszpi3hrh3mxx-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-todos-20250928.1611/magit-todos.el
(magit-todos-defscanner "git grep"
  ;; To allow git-grep to work regardless of whether `default-directory'
  ;; is in a Git repository, we use "--no-index" (which acts like "grep
  ;; -r") and "-" (STDIN, so we needn't specify files).  git-grep exits
  ;; this test with 128 if PCRE is not supported.  We also allow exit
  ;; code 1, because it means a successful grep run (i.e. "--perl-regexp"
  ;; is supported) without matches.
  :availablep (lambda ()
                (>= 1 (call-process-shell-command "git grep --no-index --quiet --perl-regexp '\\d' -- -")))
  :allow-exit-codes (0 1)
  :command (list "git" "--no-pager" "grep"
                 "--full-name" "--no-color" "-n"
                 (when depth
                   (list "--max-depth" depth))
                 (when magit-todos-ignore-case
                   "--ignore-case")
                 "--perl-regexp"
                 "-e" search-regexp-pcre
                 extra-args "--" directory
                 (when magit-todos-exclude-globs
                   (--map (concat ":!" it)
                          magit-todos-exclude-globs))
                 (unless magit-todos-submodule-list
                   (--map (list "--glob" (concat "!" it))
                          (magit-list-module-paths)))))