From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers Date: Sun, 27 Oct 2024 12:31:40 +0200 Message-ID: <86iktdalbn.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17438"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73801@debbugs.gnu.org To: Zhengyi Fu , Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 27 11:33:26 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t50aK-0004MY-6U for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 27 Oct 2024 11:33:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t50Zr-0003qe-OC; Sun, 27 Oct 2024 06:32:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t50ZV-0003ou-QS for bug-gnu-emacs@gnu.org; Sun, 27 Oct 2024 06:32:38 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t50ZP-0004a7-Na for bug-gnu-emacs@gnu.org; Sun, 27 Oct 2024 06:32:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=Jkpo3Mvg0nZt2GpgvLzllAQuZkY3QudkwQl0pPVF8WA=; b=knl6RRAJaTAqh9H6FOej9gFKoA1k44Y7nAmMzxsquczoeU7Lq7rQhDscEtOYKPgVpxI5hqUGlJeer1MsHnsWKJiNBYyE354eebxEUxbt5NMAQTL3vyBn0H2bplofh/f3VdHUKtiX5Mx9iOoNmPX/eHE8c6ImNf1JiCuiz3TwsynxKwrex4PH1bYkxGIOHlS9x6c1x3eMurQJlKOJT0aw762l7GKGIfzuHDG0YKRpPRylyBhgkbZZ+vcCQbiAxFErc8CYhPabnGjPHYLoWKeAA1KdVQYLa52Hg2BA6Kg90HHZH1ONXoxmeOUvBvqj+tH2qVTaG9TeoImLnjZ4OaxsNA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t50Zy-0006PA-93 for bug-gnu-emacs@gnu.org; Sun, 27 Oct 2024 06:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Oct 2024 10:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73801 X-GNU-PR-Package: emacs Original-Received: via spool by 73801-submit@debbugs.gnu.org id=B73801.173002514924564 (code B ref 73801); Sun, 27 Oct 2024 10:33:02 +0000 Original-Received: (at 73801) by debbugs.gnu.org; 27 Oct 2024 10:32:29 +0000 Original-Received: from localhost ([127.0.0.1]:43942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t50ZQ-0006O8-QY for submit@debbugs.gnu.org; Sun, 27 Oct 2024 06:32:29 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40578) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t50ZO-0006Nt-Pf for 73801@debbugs.gnu.org; Sun, 27 Oct 2024 06:32:27 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t50Yh-0004WZ-KV; Sun, 27 Oct 2024 06:31:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Jkpo3Mvg0nZt2GpgvLzllAQuZkY3QudkwQl0pPVF8WA=; b=DYlMnDe6fLimbQIrwJjO kcLtt3vZW5wmype23PnZAQxgkArHJPELf9KWpwcdSzVwq4lPre2pRHnMAASnbuvwUmmTBcpkjQ+gv pedient1iVriZZClAMgsXdONxNE61HzLLLSS8erl5Cwzx8abmDXOFimh3tX6XSgwdgyd7Luz8XkI5 C+L9lF3LwvcQBwZ5zFMiJed3jKXoqqXjYCtE97mtv/ka+B1GOn5TgCn08h/Se1c3IESlcgAOVUP36 nJUnatHf7VDbsfaH7bFyRtPhmQJtU2Lw/X3bRjHwbvc1tBkLyz2oa/MWxr+vxhrPsBDSvHZEOkJB4 jzmY+r5aZtXCxQ==; In-Reply-To: (message from Zhengyi Fu on Mon, 14 Oct 2024 14:29:48 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294326 Archived-At: > From: Zhengyi Fu > Date: Mon, 14 Oct 2024 14:29:48 +0800 > > 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. Philip, could you please look into this?