unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers
@ 2024-10-14  6:29 Zhengyi Fu
  0 siblings, 0 replies; only message in thread
From: Zhengyi Fu @ 2024-10-14  6:29 UTC (permalink / raw)
  To: 73801

Consider the following project:

   test-project/
   ├── .git/
   └── subproject/
       ├── marker
       └── subdir/

If `project-vc-extra-root-markers' is set to `("marker")' and
`project-try-vc' is invoked with `test-project/subproject/subdir', it will set the `project-vc'
VC property of the `test-project/subproject' directory to
`(".../test-project" project-vc nil)', so if later `project-try-vc' is
invoked with that directory, it will return a wrong result.

This is because project-vc tries to detect the VC backend by invoking
`project-try-vc' on the subproject while let binding
`project-vc-extra-root-markers' to nil and the result is cached.

The following patch can fix the problem:

--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -595,7 +595,7 @@ project-try-vc
             (let* ((project-vc-extra-root-markers nil)
                    ;; Avoid submodules scan.
                    (enable-dir-local-variables nil)
-                   (parent (project-try-vc root)))
+                   (parent (project-try-vc dir)))
               (and parent (setq backend (nth 1 parent)))))
           (setq project (list 'vc backend root))
           ;; FIXME: Cache for a shorter time.





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-14  6:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-14  6:29 bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers Zhengyi Fu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).