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

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

Signature

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

Documentation

Scan for to-dos with git-diff.

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 diff"
  ;; NOTE: This scanner implements the regexp *searching* in elisp rather than in the
  ;; external process because, unlike "git grep", "git diff" does not support PCRE.
  :command (progn
             ;; Silence byte-compiler warnings about these vars we don't use in this scanner.
             (ignore search-regexp-elisp search-regexp-pcre extra-args directory depth)
             (let ((merge-base-ref (-> "git merge-base HEAD "
                                       (concat (or magit-todos-branch-list-merge-base-ref (magit-main-branch)))
                                       shell-command-to-string
                                       string-trim)))
               (unless (string-empty-p merge-base-ref)
                 (list "git" "--no-pager" "diff" "--no-ext-diff" "--no-color" "-U0" merge-base-ref))))
  :callback 'magit-todos--git-diff-callback)