branch: externals/ivy-hydra
commit e22c8dfd28ab1874b71b68628666c22e1112495f
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    counsel.el (counsel-git-cands): Avoid an extra call to counsel-git-root
---
 counsel.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index 76be2f8..0d8c212 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1253,8 +1253,8 @@ Like `locate-dominating-file', but DIR defaults to
   (or (counsel--git-root)
       (error "Not in a Git repository")))
 
-(defun counsel-git-cands ()
-  (let ((default-directory (counsel-locate-git-root)))
+(defun counsel-git-cands (dir)
+  (let ((default-directory dir))
     (split-string
      (shell-command-to-string counsel-git-cmd)
      "\0"
@@ -1267,7 +1267,7 @@ INITIAL-INPUT can be given as the initial minibuffer 
input."
   (interactive)
   (counsel-require-program counsel-git-cmd)
   (let ((default-directory (counsel-locate-git-root)))
-    (ivy-read "Find file: " (counsel-git-cands)
+    (ivy-read "Find file: " (counsel-git-cands default-directory)
               :initial-input initial-input
               :action #'counsel-git-action
               :caller 'counsel-git)))

Reply via email to