(project-try-vc): When found non-VC project root, still search for the backend
* lisp/progmodes/project.el (project-try-vc): When finding a non-VC project root, still try to search for the containing responsible VC backend, if any (bug#65704).
This commit is contained in:
parent
dd818ed821
commit
62229fb2d1
3 changed files with 14 additions and 0 deletions
7
etc/NEWS
7
etc/NEWS
|
@ -797,6 +797,13 @@ the current project.
|
|||
The look of the key prompt in the project switcher has been changed
|
||||
slightly. To get the previous one, set this option to 'brackets'.
|
||||
|
||||
*** 'project-try-vc' tries harder to find the responsible VCS.
|
||||
When 'project-vc-extra-root-markers' is non-nil, and causes
|
||||
subdirectory project to be detected which is not a VCS root, we now
|
||||
additionally traverse the parent directories until a VCS root is found
|
||||
(if any), so that the ignore rules for that repository are used, and
|
||||
the file listing's performance is still optimized.
|
||||
|
||||
|
||||
* Incompatible Lisp Changes in Emacs 30.1
|
||||
|
||||
|
|
|
@ -567,6 +567,12 @@ See `project-vc-extra-root-markers' for the marker value format.")
|
|||
(let* ((parent (file-name-directory (directory-file-name root))))
|
||||
(setq root (vc-call-backend 'Git 'root parent))))
|
||||
(when root
|
||||
(when (not backend)
|
||||
(let* ((project-vc-extra-root-markers nil)
|
||||
;; Avoid submodules scan.
|
||||
(enable-dir-local-variables nil)
|
||||
(parent (project-try-vc root)))
|
||||
(and parent (setq backend (nth 1 parent)))))
|
||||
(setq project (list 'vc backend root))
|
||||
;; FIXME: Cache for a shorter time.
|
||||
(vc-file-setprop dir 'project-vc project)
|
||||
|
|
|
@ -137,6 +137,7 @@ When `project-ignores' includes a name matching project dir."
|
|||
(project-vc-extra-root-markers '("files-x-tests.*"))
|
||||
(project (project-current nil dir)))
|
||||
(should-not (null project))
|
||||
(should (nth 1 project))
|
||||
(should (string-match-p "/test/lisp/\\'" (project-root project)))))
|
||||
|
||||
(ert-deftest project-vc-supports-project-in-different-dir ()
|
||||
|
|
Loading…
Add table
Reference in a new issue