From 3a3cd2d4e6915d02bfb66680c2c00f3e179c7e0f Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 19 Sep 2024 22:27:26 +0200 Subject: [PATCH] Insert correct commit data into VC package descriptions * lisp/emacs-lisp/package-vc.el (package-vc-commit): Rename argument from PKG to PKG-DESC. (package-vc--generate-description-file): Update the "extras" section of the package description with the revision string at generation time. --- lisp/emacs-lisp/package-vc.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 34610102aa0..e168096e153 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -265,13 +265,13 @@ package-vc--download-and-read-archives (add-hook 'package-read-archive-hook #'package-vc--read-archive-data 20) -(defun package-vc-commit (pkg) - "Return the last commit of a development package PKG." - (cl-assert (package-vc-p pkg)) +(defun package-vc-commit (pkg-desc) + "Return the last commit of a development package PKG-DESC." + (cl-assert (package-vc-p pkg-desc)) ;; FIXME: vc should be extended to allow querying the commit of a ;; directory (as is possible when dealing with git repositories). ;; This should be a fallback option. - (cl-loop with dir = (package-desc-dir pkg) + (cl-loop with dir = (package-desc-dir pkg-desc) for file in (directory-files dir t "\\.el\\'" t) when (vc-working-revision file) return it finally return "unknown")) @@ -359,7 +359,11 @@ package-vc--generate-description-file requires)))) (list :kind 'vc) (package--alist-to-plist-args - (package-desc-extras pkg-desc)))) + (let ((extras (copy-alist (package-desc-extras pkg-desc)))) + (setf (alist-get :commit extras) + (package-vc-commit pkg-desc)) + extras) + ))) "\n") nil pkg-file nil 'silent)))) -- 2.45.2