emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 1f4b234a5c 4/5: * lisp/vc/vc-git.el (vc-git-symbolic-commit): Add


From: Philip Kaludercic
Subject: master 1f4b234a5c 4/5: * lisp/vc/vc-git.el (vc-git-symbolic-commit): Add argument FORCE
Date: Sat, 15 Oct 2022 11:23:27 -0400 (EDT)

branch: master
commit 1f4b234a5c166552e14f387515642de632a2b1a3
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    * lisp/vc/vc-git.el (vc-git-symbolic-commit): Add argument FORCE
    
    (Bug#57400)
---
 lisp/vc/vc-git.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 5d564f3c94..0eae7dd6b8 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -2030,14 +2030,19 @@ FILE can be nil."
                     (setq ok nil))))))
     (and ok str)))
 
-(defun vc-git-symbolic-commit (commit)
-  "Translate COMMIT string into symbolic form.
-Returns nil if not possible."
+(defun vc-git-symbolic-commit (commit &optional force)
+  "Translate revision string of COMMIT to a symbolic form.
+If the optional argument FORCE is non-nil, the returned value is
+allowed to include revision specifications like \"master~8\"
+\(the 8th parent of the commit currently pointed to by the master
+branch), otherwise such revision specifications are rejected, and
+the function returns nil."
   (and commit
        (let ((name (with-temp-buffer
                      (and
                       (vc-git--out-ok "name-rev" "--name-only" commit)
                       (goto-char (point-min))
+                      (or force (not (looking-at "^.*[~^].*$" t)))
                       (= (forward-line 2) 1)
                       (bolp)
                       (buffer-substring-no-properties (point-min)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]