fix(cli): handle snapshot packages

Don't execute git commands in snapshots.

Amend: 8cdddd87d9
This commit is contained in:
Henrik Lissner
2025-09-02 00:30:00 +02:00
parent 09f104795d
commit 2d28328b43

View File

@@ -997,11 +997,10 @@ Must be run from a magit diff buffer."
(condition-case-unless-debug e
(let ((straight-vc-git-post-clone-hook
(cons (lambda! (&key commit)
(print-group!
(if-let* ((pin (cdr (assoc package pinned))))
(print! (item "Pinned to %s") pin)
(when commit
(print! (item "Checked out %s") commit)))))
(if-let* ((pin (cdr (assoc package pinned))))
(print! (item "%s: pinned to %s") package pin)
(when commit
(print! (item "%s: checked out %s") package commit))))
straight-vc-git-post-clone-hook)))
(straight-use-package (intern package))
(when (file-in-directory-p repo-dir straight-base-dir)
@@ -1106,20 +1105,22 @@ Must be run from a magit diff buffer."
(print! (item "\r(%d/%d) %s is up-to-date...%s") i total package esc)
(cl-return))
((file-exists-p ".straight-commit")
(print! (start "\r(%d/%d) Downloading %s...%s") i total package esc)
(delete-directory default-directory t)
(straight-vc-git-clone recipe target-ref)
(doom-packages--same-commit-p target-ref (straight-vc-get-commit type local-repo)))
((if (straight-vc-commit-present-p recipe target-ref)
(print! (start "\r(%d/%d) Checking out %s (%s)...%s")
i total package (doom-packages--abbrev-commit target-ref) esc)
(print! (start "\r(%d/%d) Fetching %s...%s") i total package esc)
(and (straight-vc-fetch-from-remote recipe)
(straight-vc-commit-present-p recipe target-ref)))
(if (file-exists-p ".straight-commit")
(progn
(delete-directory default-directory t)
(straight-vc-git-clone recipe target-ref))
(straight-vc-check-out-commit recipe target-ref)
(or (not (eq type 'git))
(setq output (doom-packages--commit-log-between ref target-ref)
commits (length (split-string output "\n" t)))))
(straight-vc-check-out-commit recipe target-ref)
(or (not (eq type 'git))
(setq output (doom-packages--commit-log-between ref target-ref)
commits (length (split-string output "\n" t))))
(doom-packages--same-commit-p target-ref (straight-vc-get-commit type local-repo)))
((print! (start "\r(%d/%d) Re-cloning %s...") i total local-repo esc)