summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
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")