1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-05-10 15:25:04 -07:00

vc-switch-working-tree: Use project-current again

* lisp/vc/vc.el (vc-switch-working-tree): Use project-current
instead of manually constructing VC project objects.
This commit is contained in:
Dmitry Gutov 2026-05-08 12:25:49 +01:00 committed by Sean Whitton
parent 060451d6e0
commit f94637749a

View file

@ -5789,14 +5789,11 @@ to the root of this working tree."
(let ((backend (or (vc-deduce-backend)
(vc-responsible-backend default-directory)
(error "No VC backend"))))
;; Manually construct VC project objects because `project-current'
;; might find a non-VC project within the VC working tree containing
;; DIRECTORY, but we should ignore that (bug#80939).
;; Skip to the VC root, otherwise `project-current' could find a
;; non-VC project between DEFAULT-DIRECTORY and there (bug#80939).
(funcall project-find-matching-buffer-function
`(vc ,backend ,(vc-root-dir backend))
`(vc ,backend
,(let ((default-directory directory))
(vc-root-dir backend))))))
(project-current nil (vc-root-dir backend))
(project-current nil directory))))
;;;###autoload
(defun vc-working-tree-switch-project (dir)