Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix: error invoking shell command when not in git repo. #2

Merged
merged 1 commit into from

2 participants

@vic

The find-git-repo function returns nil when not in a repo instead
of outputing a message, let the interactive anything-git-goto
function do it instead.

@vic vic Dont produce candidates when not in git repo.
The find-git-repo function returns nil when not in a repo instead
of outputing a message, let the interactive anything-git-goto
function do it instead.
c632488
@jpablobr jpablobr merged commit 77eaf20 into jpablobr:master
@jpablobr
Owner

:metal:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 10, 2012
  1. @vic

    Dont produce candidates when not in git repo.

    vic authored
    The find-git-repo function returns nil when not in a repo instead
    of outputing a message, let the interactive anything-git-goto
    function do it instead.
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 8 deletions.
  1. +13 −8 anything-git-goto.el
View
21 anything-git-goto.el
@@ -66,7 +66,7 @@
(defun anything-git-goto-find-git-repo (dir)
"Recursively search for a .git/ directory."
(if (string= "/" dir)
- (message "not in a git repo.")
+ nil ;; not in a git repo
(if (file-exists-p (expand-file-name ".git/" dir))
dir
(anything-git-goto-find-git-repo (expand-file-name "../" dir)))))
@@ -85,10 +85,13 @@
(defvar anything-c-source-git-goto
'((name . "Git goto")
(init . (lambda ()
- (call-process-shell-command
- (format git-goto-cmd
- (anything-git-goto-find-git-repo default-directory))
- nil (anything-candidate-buffer 'global))))
+ (let ((git-root
+ (anything-git-goto-find-git-repo default-directory)))
+ (and git-root
+ (call-process-shell-command
+ (format git-goto-cmd
+ (anything-git-goto-find-git-repo default-directory))
+ nil (anything-candidate-buffer 'global))))))
(candidate-number-limit . 9999)
(candidates-in-buffer)
(action . anything-git-goto-file))
@@ -98,10 +101,12 @@
(defun anything-git-goto ()
"Git Find files."
(interactive)
- (anything-other-buffer
- '(anything-c-source-git-goto) *anything-git-goto-buffer-name*))
+ (if (anything-git-goto-find-git-repo default-directory)
+ (anything-other-buffer
+ '(anything-c-source-git-goto) *anything-git-goto-buffer-name*)
+ (message "Not in a git repo")))
(provide 'anything-git-goto)
-;;; anything-git-goto.el ends here
+;;; anything-git-goto.el ends here
Something went wrong with that request. Please try again.