From 9f81e8a0e609b209e79ea9f275fea6a54ebb46c8 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 4 Oct 2015 01:03:22 -0400 Subject: magit-shorten-hash-at-point: Don't fail outside repo --- lisp/init-git.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/init-git.el') diff --git a/lisp/init-git.el b/lisp/init-git.el index f9c7ae7..666af88 100644 --- a/lisp/init-git.el +++ b/lisp/init-git.el @@ -376,7 +376,9 @@ argument." (hash (match-string 0))) (when (< hash-len n) (user-error "Desired hash length is greater than current")) - (replace-match (km/magit-shorten-hash hash n) + (replace-match (or (km/magit-shorten-hash hash n) + ;; We're not in a repo. + (substring hash 0 n)) 'fixedcase) (when (< offset n) (skip-chars-backward "A-z0-9") -- cgit v1.2.3