Always update VC packages from a vc-dir buffer

* lisp/emacs-lisp/package-vc.el (vc-dir-prepare-status-buffer):
Add a declaration.
(package-vc-upgrade): Prepare a dummy vc-dir buffer to ensure
that 'vc-pull' (or rather 'vc-deduce-fileset') can correctly
infer the VC backend to use.  (bug#70526)
This commit is contained in:
Philip Kaludercic 2024-04-26 08:21:37 +02:00
parent 32ed3d2679
commit 758fe9b670

View file

@ -774,6 +774,9 @@ conflicts with its remote repository state."
(package-vc-upgrade pkg-desc))))
(message "Done upgrading packages."))
(declare-function vc-dir-prepare-status-buffer "vc-dir"
(bname dir backend &optional create-new))
;;;###autoload
(defun package-vc-upgrade (pkg-desc)
"Upgrade the package described by PKG-DESC from package's VC repository.
@ -810,7 +813,10 @@ with the remote repository state."
(remove-hook 'vc-post-command-functions post-upgrade))))))
(add-hook 'vc-post-command-functions post-upgrade)
(with-demoted-errors "Failed to fetch: %S"
(let ((default-directory pkg-dir))
(require 'vc-dir)
(with-current-buffer (vc-dir-prepare-status-buffer
(format " *package-vc-dir: %s*" pkg-dir)
pkg-dir (vc-responsible-backend pkg-dir))
(vc-pull)))))
(defun package-vc--archives-initialize ()