diff options
| author | Philip Kaludercic | 2024-02-27 10:32:08 +0100 |
|---|---|---|
| committer | Philip Kaludercic | 2024-02-27 10:32:33 +0100 |
| commit | b59d7094b6cb1a09f46f933807e9cd00a8bd1547 (patch) | |
| tree | fca1daee129e218a12ad92a5c50453202bdea97e | |
| parent | 32b4f9d21b14190f1ed1611515751abe4b90fa68 (diff) | |
| download | emacs-b59d7094b6cb1a09f46f933807e9cd00a8bd1547.tar.gz emacs-b59d7094b6cb1a09f46f933807e9cd00a8bd1547.zip | |
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.
| -rw-r--r-- | lisp/vc/vc-git.el | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 456417e566e..18b4a8691e9 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el | |||
| @@ -1411,9 +1411,16 @@ This prompts for a branch to merge from." | |||
| 1411 | (vc-message-unresolved-conflicts buffer-file-name))) | 1411 | (vc-message-unresolved-conflicts buffer-file-name))) |
| 1412 | 1412 | ||
| 1413 | (defun vc-git-clone (remote directory rev) | 1413 | (defun vc-git-clone (remote directory rev) |
| 1414 | (if rev | 1414 | "Attempt to clone REMOTE repository into DIRECTORY at revision REV." |
| 1415 | (vc-git--out-ok "clone" "--branch" rev remote directory) | 1415 | (cond |
| 1416 | ((null rev) | ||
| 1416 | (vc-git--out-ok "clone" remote directory)) | 1417 | (vc-git--out-ok "clone" remote directory)) |
| 1418 | ((ignore-errors | ||
| 1419 | (vc-git--out-ok "clone" "--branch" rev remote directory))) | ||
| 1420 | ((vc-git--out-ok "clone" remote directory) | ||
| 1421 | (let ((default-directory directory)) | ||
| 1422 | (vc-git--out-ok "checkout" rev))) | ||
| 1423 | ((error "Failed to check out %s at %s" remote rev))) | ||
| 1417 | directory) | 1424 | directory) |
| 1418 | 1425 | ||
| 1419 | ;;; HISTORY FUNCTIONS | 1426 | ;;; HISTORY FUNCTIONS |