From a91f93a33a7aa825221b94ec32859d5cca2872a1 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 1 Sep 2025 21:19:03 +0200 Subject: [PATCH] fix(cli): failure to repin packages installed from snapshots When a pinned package is repinned, the package manager attempts to `git checkout` the new pin, which won't work if the package isn't a git repo (see 8cdddd87). Amend: 8cdddd87d948 --- lisp/lib/packages.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lisp/lib/packages.el b/lisp/lib/packages.el index 10a0dcee4..32745f828 100644 --- a/lisp/lib/packages.el +++ b/lisp/lib/packages.el @@ -1112,10 +1112,14 @@ Must be run from a magit diff buffer." (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))) - (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)))) + (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))))) (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) @@ -1163,7 +1167,7 @@ Must be run from a magit diff buffer." (if (> n 0) (format " (w/ %d dependents)" n) ""))) - (unless (string-empty-p output) + (when (and (stringp output) (not (string-empty-p output))) (let ((lines (split-string output "\n"))) (setq output (if (> (length lines) 20)