This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun git-grep-dired (repo wildcards regexp) | |
"Find Git-controlled files in DIR with a name like WILDCARDS containing a regexp REGEXP and start Dired on output." | |
(interactive "DGit-grep (directory): \nsGit-grep (filename wildcard(s), e.g. *.xml): \nsGit-grep (grep regexp): ") | |
(setq repo (file-name-as-directory (expand-file-name repo))) | |
(switch-to-buffer (concat "*Git Grep " repo "*")) | |
(fundamental-mode) | |
(setq buffer-read-only nil) | |
(erase-buffer) | |
(setq default-directory repo) | |
(let ((cmd (format "git --git-dir %s/.git ls-files -z%s | xargs -0 grep -lZ -- %s | xargs -0 ls -l" |