GNU bug report logs - #27840
26.0.50; vc-git-grep stopped working on git master

Previous Next

Package: emacs;

Reported by: Tom Tromey <tom <at> tromey.com>

Date: Wed, 26 Jul 2017 17:59:02 UTC

Severity: normal

Tags: fixed

Found in version 26.0.50

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: npostavs <at> users.sourceforge.net
To: Tom Tromey <tom <at> tromey.com>, Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 27840 <at> debbugs.gnu.org
Subject: bug#27840: 26.0.50; vc-git-grep stopped working on git master
Date: Wed, 26 Jul 2017 19:32:18 -0400
[Message part 1 (text/plain, inline)]
Tom Tromey <tom <at> 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.

[v1-0001-Use-null-for-git-grep-too-Bug-27840.patch (text/x-diff, inline)]
From 60acf5de6dacb5ea3430a1115ba8c1151a07d526 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> 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

[Message part 3 (text/plain, inline)]

[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

This bug report was last modified 7 years and 294 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.