[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master beee0b7 048/348: counsel.el (counsel-git): Add better erro
From: |
Oleh Krehel |
Subject: |
[elpa] master beee0b7 048/348: counsel.el (counsel-git): Add better error message |
Date: |
Sat, 8 Apr 2017 11:03:22 -0400 (EDT) |
branch: master
commit beee0b7bd1c935f2eb369709031d7bc274a6a926
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-git): Add better error message
When not in a git directory.
Fixes #537
---
counsel.el | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/counsel.el b/counsel.el
index 94cc98e..73ffa21 100644
--- a/counsel.el
+++ b/counsel.el
@@ -748,18 +748,21 @@ Describe the selected candidate."
(defun counsel-git ()
"Find file in the current Git repository."
(interactive)
- (setq counsel--git-dir (expand-file-name
- (locate-dominating-file
- default-directory ".git")))
- (let* ((default-directory counsel--git-dir)
- (cands (split-string
- (shell-command-to-string
- "git ls-files --full-name --")
- "\n"
- t)))
- (ivy-read (funcall counsel-prompt-function "Find file")
- cands
- :action #'counsel-git-action)))
+ (setq counsel--git-dir (locate-dominating-file
+ default-directory ".git"))
+ (if (null counsel--git-dir)
+ (error "Not in a git repository")
+ (setq counsel--git-dir (expand-file-name
+ counsel--git-dir))
+ (let* ((default-directory counsel--git-dir)
+ (cands (split-string
+ (shell-command-to-string
+ "git ls-files --full-name --")
+ "\n"
+ t)))
+ (ivy-read (funcall counsel-prompt-function "Find file")
+ cands
+ :action #'counsel-git-action))))
(defun counsel-git-action (x)
(with-ivy-window
- [elpa] master 5826c86 035/348: ivy.el (ivy--reset-state): Add workaround for dired-do-copy, (continued)
- [elpa] master 5826c86 035/348: ivy.el (ivy--reset-state): Add workaround for dired-do-copy, Oleh Krehel, 2017/04/08
- [elpa] master f57e2fb 039/348: ivy.el (ivy-immediate-done): Update docstring, Oleh Krehel, 2017/04/08
- [elpa] master 4f57a3a 041/348: Add forth-block-mode, Oleh Krehel, 2017/04/08
- [elpa] master db94a12 043/348: ivy.el (ivy-completion-in-region): Fix double insert bug, Oleh Krehel, 2017/04/08
- [elpa] master de91a77 042/348: swiper.el (swiper-occur): Add require, Oleh Krehel, 2017/04/08
- [elpa] master fabcdc0 004/348: doc/Changelog.org: Add custom ids and whitespace in the end, Oleh Krehel, 2017/04/08
- [elpa] master c30a6e2 046/348: ivy.el (ivy-minibuffer-map): Undo remap, Oleh Krehel, 2017/04/08
- [elpa] master 3e1a940 045/348: counsel.el: Fix byte compile warnings, Oleh Krehel, 2017/04/08
- [elpa] master c960de5 047/348: counsel.el (counsel-grep-or-swiper): Don't grep on compressed files, Oleh Krehel, 2017/04/08
- [elpa] master 2776358 059/348: Show current value of the variable in the prompt, Oleh Krehel, 2017/04/08
- [elpa] master beee0b7 048/348: counsel.el (counsel-git): Add better error message,
Oleh Krehel <=
- [elpa] master 65948fc 053/348: colir.el (colir-parse-color): Fix color parsing in terminal, Oleh Krehel, 2017/04/08
- [elpa] master e987cef 061/348: counsel.el (counsel-read-setq-expression): Fix Eldoc nag, Oleh Krehel, 2017/04/08
- [elpa] master 0091c8a 058/348: ivy.el (ivy-set-prompt-text-properties-function): New devar, Oleh Krehel, 2017/04/08
- [elpa] master 473c595 064/348: Facilitate the sorting of cons cell input to ivy-read, Oleh Krehel, 2017/04/08
- [elpa] master 23bd7a4 075/348: counsel.el (counsel-git): Add :caller, Oleh Krehel, 2017/04/08
- [elpa] master 74358c2 070/348: Purge all dependency on helm-rhythmbox, Oleh Krehel, 2017/04/08
- [elpa] master 56aa605 076/348: ivy.el (ivy-add-prompt-count): Refactor from ivy--reset-state, Oleh Krehel, 2017/04/08
- [elpa] master 9c01abf 003/348: doc/Changelog.org: Add hlines, Oleh Krehel, 2017/04/08
- [elpa] master e53f256 087/348: ivy.el (ivy-minibuffer-map): Move ivy-toggle-regexp-quote from "M-q" to "M-r", Oleh Krehel, 2017/04/08
- [elpa] master af5f097 108/348: counsel.el (counsel-locate-action-extern): Make interactive, Oleh Krehel, 2017/04/08