Subject: bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files

From: Óscar Fuentes <[email-masked]>
Date: Sun, 07 Feb 2016 04:17:03 +0100

emacs -Q
M-x vc-dir <top directory of a git repo. Emacs' for instance>
M-x vc-git-grep
Search for: foo
Search for "foo" in files (default all): <ENTER (accept default)>
In directory: <ENTER (accept default)>

The command fails with

-*- mode: grep; default-directory: "~/dev/emacs/emacs/" -*-
Grep started at Sun Feb  7 03:54:09

git --no-pager grep -n -e VC -- * .*
fatal: ..: '..' is outside repository

Grep exited abnormally with code 128 at Sun Feb  7 03:54:09

The problem consists on `all' defaulting to the file patterns "* .*", as
defined in the variable `grep-files-aliases'. Those patterns matches
".." (the parent directory) which is outside the git repo (when you
execute vc-git-grep on the top directory of the repo.)

BTW, this pattern creates unnecesary noise when used with the `grep'
commands, adding to the grep output lines such as

grep: .: Is a directory
grep: ..: Is a directory

I propose the following patch to fix this problem. Shell gurus, please
review.

diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 7e6f157..3f77a2a 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -189,7 +189,7 @@ grep-find-template
   :group 'grep)
 
 (defcustom grep-files-aliases
-  '(("all" .   "* .*")
+  '(("all" .   "* .[^\\.]*")
     ("el" .    "*.el")
     ("ch" .    "*.[ch]")
     ("c" .     "*.c")

In GNU Emacs 25.0.50.29 (x86_64-unknown-linux-gnu, X toolkit)
 of 2016-01-21 built on qcore
Repository revision: 5293d1bdb3e665a565af032a163004c976328cc2
Windowing system distributor 'The X.Org Foundation', version 11.0.11702000
System Description:	Ubuntu 15.10

Configured using:
 'configure --without-toolkit-scroll-bars --with-x-toolkit=lucid'

Configured features:
XAW3D XPM JPEG TIFF GIF PNG SOUND GSETTINGS NOTIFY GNUTLS LIBXML2
FREETYPE XFT ZLIB LUCID X11

Important settings:
  value of $LANG: C
  locale-coding-system: nil

Major mode: Emacs-Lisp