Skip to content

Commit

Permalink
Merge: (-defscanner "git grep") Update for newer git versions
Browse files Browse the repository at this point in the history
See #186.
  • Loading branch information
alphapapa committed Sep 9, 2024
2 parents 60b6bd9 + 07042ee commit eb851a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ Note that if TRAMP can't find the scanner configured in option ~magit-todos-scan
+ Obsolete option ~magit-todos-insert-at~, replaced by option ~magit-todos-insert-after~. (Scheduled for removal since v1.6.)

*Fixes*
+ Disable external diff drivers when calling ~git diff~. ([[https://github.com/alphapapa/magit-todos/pull/174][#174]]. Thanks to [[https://github.com/bcc32][Aaron Zeng]].)
+ Disable external diff drivers when calling ~git diff~. ([[https://github.com/alphapapa/magit-todos/pull/174][#174]]. Thanks to [[https://github.com/bcc32][Aaron Zeng]].)

*Compatibility*
+ Update test for ~git-grep~ scanner compatibility for newer versions of Git. (See [[https://github.com/alphapapa/magit-todos/issues/186][#186]]. Thanks to [[https://github.com/KarlJoad][Karl Hallsby]].)

** 1.7.2

Expand Down
8 changes: 7 additions & 1 deletion magit-todos.el
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,13 @@ When SYNC is non-nil, match items are returned."
extra-args search-regexp-pcre directory))

(magit-todos-defscanner "git grep"
:test (string-match "--perl-regexp" (shell-command-to-string "git grep --magit-todos-testing-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.
:test (>= 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"
Expand Down

0 comments on commit eb851a0

Please sign in to comment.