summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-07-10 22:12:52 -0400
committerKyle Meyer <kyle@kyleam.com>2015-07-10 22:12:52 -0400
commite880a34d1af5fc4be480900075342a38131668da (patch)
tree3f4150602dc4ffe371374aa9841a41fc1e5c2c66 /lisp
parent2b600c2f802c1239e06aeab9a310c7a88bc43d12 (diff)
downloademacs.d-e880a34d1af5fc4be480900075342a38131668da.tar.gz
Fix magit-insert-staged-file
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-git.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/init-git.el b/lisp/init-git.el
index 2b4cbfb..2c1b145 100644
--- a/lisp/init-git.el
+++ b/lisp/init-git.el
@@ -264,12 +264,12 @@ By default, the path for the file name is relative to the top
directory of the repository. Remove the directory component from
the file name if NO-DIRECTORY is non-nil."
(interactive "P")
- (let* ((default-directory (magit-toplevel))
- (files (magit-staged-files))
+ (unless (magit-toplevel)
+ (user-error "Not in git repo"))
+ (let* ((files (magit-staged-files))
(file (if (= 1 (length files))
(car files)
- (completing-read "Staged file: " (magit-staged-files)
- nil t))))
+ (completing-read "Staged file: " files nil t))))
(insert (if no-directory (file-name-nondirectory file) file))))
(define-key ctl-x-4-map "g" 'magit-find-file-other-window)