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.
This commit is contained in:
Philip Kaludercic 2024-09-19 22:27:26 +02:00
parent 98177d4b3d
commit 4f5fc519f0
No known key found for this signature in database

View file

@ -265,13 +265,13 @@ asynchronously."
(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 @@ asynchronously."
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))))