branch: master
commit a9a4e81655323e4bb7227712c897d19ea242de47
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    counsel.el (counsel-git-grep): Fix the default-directory
---
 counsel.el |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/counsel.el b/counsel.el
index a2a0ad4..33364f7 100644
--- a/counsel.el
+++ b/counsel.el
@@ -160,7 +160,9 @@
 (defun counsel-git-grep ()
   "Grep for a string in the current git repository."
   (interactive)
-  (let ((val (ivy-read "pattern: " 'counsel-git-grep-function))
+  (let ((default-directory (locate-dominating-file
+                             default-directory ".git"))
+        (val (ivy-read "pattern: " 'counsel-git-grep-function))
         lst)
     (when val
       (setq lst (split-string val ":"))

Reply via email to