bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27840: 26.0.50; vc-git-grep stopped working on git master


From: npostavs
Subject: bug#27840: 26.0.50; vc-git-grep stopped working on git master
Date: Wed, 26 Jul 2017 19:32:18 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)

Tom Tromey <tom@tromey.com> writes:

> I am running a build of git master from yesterday.
> I tried M-x vc-git-grep.
>
> This successfully runs the grep and puts the output into *grep*.
> However, the highlighting is incorrect and M-x next-error claims there
> are no grep hits.  Using C-c (compile-goto-error) in *grep* also does
> not work.

This is due to [1: 644cdd1aa0].  'git grep' also has a '--null' option,
but the output is a bit different.  Here is a patch to handle it,
although it's not complete: it doesn't take the value of
grep-use-null-filename-separator into account.  Perhaps we should
instead disable this option by default; when I introduced it, I didn't
think about the fact that grep.el is used for not-quite-grep programs as
well.

>From 60acf5de6dacb5ea3430a1115ba8c1151a07d526 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Wed, 26 Jul 2017 19:21:55 -0400
Subject: [PATCH v1] Use '--null' for 'git grep' too (Bug#27840)

* lisp/vc/vc-git.el (vc-git-grep): Pass '--null'.
* lisp/progmodes/grep.el (grep--regexp-alist-bin-matcher): Handle the
slightly different output from 'git grep's --null option.
---
 lisp/progmodes/grep.el | 5 +++--
 lisp/vc/vc-git.el      | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 2ddaf884bc..4723290fbe 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -387,8 +387,9 @@ (defconst grep--regexp-alist-column
 (defconst grep--regexp-alist-bin-matcher
   '("^Binary file \\(.+\\) matches$" 1 nil nil 0 1))
 (defconst grep-with-null-regexp-alist
-  `(("^\\([^\0]+\\)\\(\0\\)\\([0-9]+\\):" 1 3 ,grep--regexp-alist-column nil 
nil
-     (2 '(face unspecified display ":")))
+  `(("^\\([^\0]+\\)\\(\0\\)\\([0-9]+\\)\\([\0:]\\)" 1 3 
,grep--regexp-alist-column nil nil
+     (2 '(face unspecified display ":"))
+     (4 '(face unspecified display ":")))
     ,grep--regexp-alist-bin-matcher)
   "Regexp used to match grep hits.
 See `compilation-error-regexp-alist'.")
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index cc3e295641..1cdcfb3a5c 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1433,8 +1433,8 @@ (defun vc-git-grep (regexp &optional files dir)
              (setq command nil))
        (setq dir (file-name-as-directory (expand-file-name dir)))
        (setq command
-             (grep-expand-template "git --no-pager grep -n -e <R> -- <F>"
-                                    regexp files))
+             (grep-expand-template
+               "git --no-pager grep -n --null -e <R> -- <F>" regexp files))
        (when command
          (if (equal current-prefix-arg '(4))
              (setq command
-- 
2.11.1


[1: 644cdd1aa0]: 2017-07-19 20:03:00 -0400
  Use grep's --null option (Bug#6843)
  
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=644cdd1aa0a10dbfffa3b9b4c7a97f8cddded0b8

reply via email to

[Prev in Thread] Current Thread [Next in Thread]