1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-03 22:20:52 -08:00

Allow vc-git-clone to check-out arbitrary revisions

* lisp/vc/vc-git.el (vc-git-clone): If "git clone --branch"
fails, then clone the repository regularly and checkout the
requested revision.
This commit is contained in:
Philip Kaludercic 2024-02-27 10:32:08 +01:00
parent 32b4f9d21b
commit b59d7094b6

View file

@ -1411,9 +1411,16 @@ This prompts for a branch to merge from."
(vc-message-unresolved-conflicts buffer-file-name)))
(defun vc-git-clone (remote directory rev)
(if rev
(vc-git--out-ok "clone" "--branch" rev remote directory)
"Attempt to clone REMOTE repository into DIRECTORY at revision REV."
(cond
((null rev)
(vc-git--out-ok "clone" remote directory))
((ignore-errors
(vc-git--out-ok "clone" "--branch" rev remote directory)))
((vc-git--out-ok "clone" remote directory)
(let ((default-directory directory))
(vc-git--out-ok "checkout" rev)))
((error "Failed to check out %s at %s" remote rev)))
directory)
;;; HISTORY FUNCTIONS