Fix #5088: failure to install straight.el

This commit is contained in:
Henrik Lissner 2021-05-24 14:33:12 -04:00
parent 3d19fab59c
commit ab1000c8d0

View file

@ -118,27 +118,44 @@ uses a straight or package.el command directly).")
"://github.com/" "://github.com/"
(or (plist-get recipe :repo) "raxod502/straight.el"))) (or (plist-get recipe :repo) "raxod502/straight.el")))
(branch (or (plist-get recipe :branch) straight-repository-branch)) (branch (or (plist-get recipe :branch) straight-repository-branch))
(call (if doom-debug-p #'doom-exec-process #'doom-call-process))) (call (if doom-debug-p
(lambda (&rest args)
(print! "%s" (cdr (apply #'doom-call-process args))))
(lambda (&rest args)
(message "%s" (cdr (apply #'doom-call-process args)))))))
(unless (file-directory-p repo-dir) (unless (file-directory-p repo-dir)
(message "Installing straight...") (print! (start "Installing straight..."))
(cond (print-group!
((eq straight-vc-git-default-clone-depth 'full) (cl-destructuring-bind (depth . options)
(funcall call "git" "clone" "--origin" "origin" repo-url repo-dir)) (doom-enlist straight-vc-git-default-clone-depth)
((null pin) (let ((branch-switch (if (memq 'single-branch options)
(funcall call "git" "clone" "--origin" "origin" repo-url repo-dir "--single-branch"
"--depth" (number-to-string straight-vc-git-default-clone-depth) "--no-single-branch")))
"--branch" straight-repository-branch (cond
"--single-branch" "--no-tags")) ((eq 'full depth)
((integerp straight-vc-git-default-clone-depth) (funcall call "git" "clone" "--origin" "origin"
(make-directory repo-dir t) branch-switch repo-url repo-dir))
(let ((default-directory repo-dir)) ((integerp depth)
(funcall call "git" "init") (if (null pin)
(funcall call "git" "checkout" "-b" straight-repository-branch) (progn
(funcall call "git" "remote" "add" "origin" repo-url) (when (file-directory-p repo-dir)
(funcall call "git" "fetch" "origin" pin (delete-directory repo-dir 'recursive))
"--depth" (number-to-string straight-vc-git-default-clone-depth) (funcall call "git" "clone" "--origin" "origin" repo-url
"--no-tags") "--no-checkout" repo-dir
(funcall call "git" "checkout" "--detach" pin))))) "--depth" (number-to-string depth)
branch-switch
"--no-tags"
"--branch" straight-repository-branch))
(make-directory repo-dir 'recursive)
(let ((default-directory repo-dir))
(funcall call "git" "init" "-b" straight-repository-branch)
(funcall call "git" "remote" "add" "origin" repo-url
"--master" straight-repository-branch)
(funcall call "git" "fetch" "origin" pin
"--depth" (number-to-string depth)
"--no-tags")
(funcall call "git" "reset" "--hard" pin)))))))
(print! (success "Done!"))))
(require 'straight (concat repo-dir "/straight.el")) (require 'straight (concat repo-dir "/straight.el"))
(doom-log "Initializing recipes") (doom-log "Initializing recipes")
(with-temp-buffer (with-temp-buffer