1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Find most specific backend for `vc-backend-for-registration'.

* lisp/vc/vc.el (vc-backend-for-registration): Count file name
components instead of the length of the file name string (bug#50572).
This commit is contained in:
Manuel Giraud 2021-11-14 01:51:31 +01:00 committed by Lars Ingebrigtsen
parent 4df334a0f7
commit 439a3094ff

View file

@ -944,8 +944,10 @@ use."
bk)
(dolist (backend vc-handled-backends)
(when (not (vc-call-backend backend 'registered file))
(let* ((path (vc-call-backend backend 'responsible-p file))
(len (length path)))
(let* ((dir-name (vc-call-backend backend 'responsible-p file))
(len (and dir-name
(length (file-name-split
(expand-file-name dir-name))))))
(when (and len (> len max))
(setq max len bk backend)))))
(when bk
@ -977,7 +979,7 @@ use."
(message "arg %s" arg)
(and (file-directory-p arg)
(string-prefix-p (expand-file-name arg) def-dir)))))))
(let ((default-directory repo-dir))
(let ((default-directory repo-dir))
(vc-call-backend bk 'create-repo))
(throw 'found bk))))