branch: elpa/magit
commit dc67550f9b61a96a42de490da400ecf7a4746258
Author: Thomas <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    magit--abbrev-if-oid: Do the cheap test first
    
    Avoid a potential expensive call to `magit-ref-p' in the common case
---
 lisp/magit-git.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 5c3bf7159f..7dbe4d746c 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -2389,7 +2389,7 @@ If `first-parent' is set, traverse only first parents."
   (magit-rev-parse (magit-abbrev-arg "short") rev))
 
 (defun magit--abbrev-if-oid (obj)
-  (cond ((or (magit-ref-p obj) (member obj '("{index}" "{worktree}"))) obj)
+  (cond ((or (member obj '("{index}" "{worktree}")) (magit-ref-p obj)) obj)
         ((magit-rev-parse (magit-abbrev-arg "short") obj))
         (obj)))
 

Reply via email to