diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 5d564f3c94..47c9082368 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -2030,14 +2030,17 @@ vc-git--run-command-string (setq ok nil)))))) (and ok str))) -(defun vc-git-symbolic-commit (commit) +(defun vc-git-symbolic-commit (commit &optional force) "Translate COMMIT string into symbolic form. -Returns nil if not possible." +Returns nil if not possible. If the optional argument FORCE is +non-nil, revisions containing positional +arguments (e.g. \"master~8\") will also be accepted." (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)