summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-10-04 01:03:22 -0400
committerKyle Meyer <kyle@kyleam.com>2015-10-04 01:03:22 -0400
commit9f81e8a0e609b209e79ea9f275fea6a54ebb46c8 (patch)
treea75c71b49d0811bf6c64ecba78218b89c9b1b52a /lisp
parentc740d447410550577fd056186a54bb6c13ac6150 (diff)
downloademacs.d-9f81e8a0e609b209e79ea9f275fea6a54ebb46c8.tar.gz
magit-shorten-hash-at-point: Don't fail outside repo
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-git.el4
1 files changed, 3 insertions, 1 deletions
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")