unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: Zhengyi Fu <i@fuzy.me>, 73801@debbugs.gnu.org
Subject: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers
Date: Mon, 28 Oct 2024 06:06:17 +0200	[thread overview]
Message-ID: <3b9816c7-bec3-4743-ad1a-49332c158099@gutov.dev> (raw)
In-Reply-To: <xifv7wldyrnqn7.fsf@hp.com>

Hi! Thanks for the report.

On 14/10/2024 09:29, Zhengyi Fu wrote:
> 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))

I've pushed a different fix in commit 29b30eb49f8 (with slightly better 
performance, I think).

Please try it when you can.

It would be nice to get either of the patches into Emacs 30, too, but it 
might be a little late given where it is in the pretest.





  parent reply	other threads:[~2024-10-28  4:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14  6:29 bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers Zhengyi Fu
2024-10-27 10:31 ` Eli Zaretskii
2024-10-28  4:06 ` Dmitry Gutov [this message]
2024-10-29  2:44   ` Dmitry Gutov
2024-10-29 13:33     ` Eli Zaretskii
2024-10-29 20:31       ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3b9816c7-bec3-4743-ad1a-49332c158099@gutov.dev \
    --to=dmitry@gutov.dev \
    --cc=73801@debbugs.gnu.org \
    --cc=i@fuzy.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).