branch: elpa/git-commit
commit 713bebef9e7ff2a730282a934463d332147b6816
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    magit--rev-dereference: Handle nil REV
    
    REV can also be nil, which we didn't take into account when adding
    this function in [1: 3cb7f5ba43].
    
    Closes #4667.
    
    1: 2022-04-25 3cb7f5ba430906bded9e5d9951f5260ab25644d0
       Support revisions that match commit message
---
 lisp/magit-git.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 65fa1b4ced..0604bbda5d 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -1287,10 +1287,10 @@ string \"true\", otherwise return nil."
 
 (defun magit--rev-dereference (rev)
   "Return a rev that forces Git to interpret REV as a commit.
-If REV has the form \":/TEXT\", instead return it as-is"
-  (if (string-match-p "^:/" rev)
-      rev
-    (concat rev "^{commit}")))
+If REV is nil or has the form \":/TEXT\", return REV itself."
+  (cond ((not rev) nil)
+        ((string-match-p "^:/" rev) rev)
+        (t (concat rev "^{commit}"))))
 
 (defun magit-rev-equal (a b)
   "Return t if there are no differences between the commits A and B."

Reply via email to