]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/vc/vc-git.el (vc-git-grep): Set dir to default-directory
authorJuri Linkov <juri@linkov.net>
Wed, 12 Sep 2018 22:09:53 +0000 (01:09 +0300)
committerJuri Linkov <juri@linkov.net>
Wed, 12 Sep 2018 22:09:53 +0000 (01:09 +0300)
when it's not available (like it's implemented in lgrep/rgrep)
to prevent error in case of `C-u C-u vc-git-grep'.

lisp/vc/vc-git.el

index 69d629570263d18892daae6fbb8a0226484e403b..ca457fb3d1e9850c781bb4feb66af17241639cac 100644 (file)
@@ -1440,8 +1440,7 @@ This command shares argument histories with \\[rgrep] and \\[grep]."
      (cond
       ((equal current-prefix-arg '(16))
        (list (read-from-minibuffer "Run: " "git grep"
-                                  nil nil 'grep-history)
-            nil))
+                                  nil nil 'grep-history)))
       (t (let* ((regexp (grep-read-regexp))
                (files
                  (mapconcat #'shell-quote-argument
@@ -1451,6 +1450,8 @@ This command shares argument histories with \\[rgrep] and \\[grep]."
           (list regexp files dir))))))
   (require 'grep)
   (when (and (stringp regexp) (> (length regexp) 0))
+    (unless (and dir (file-accessible-directory-p dir))
+      (setq dir default-directory))
     (let ((command regexp))
       (if (null files)
          (if (string= command "git grep")