GNU bug report logs - #42966
28.0.50; vc-dir: wrong backend

Previous Next

Package: emacs;

Reported by: sds <at> gnu.org

Date: Fri, 21 Aug 2020 15:16:02 UTC

Severity: minor

Tags: fixed

Merged with 3807, 8179, 8603, 18514

Found in versions 23.3.50, 24.0.50, 24.3, 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #61 received at 42966 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, Sam Steingold <sds <at> gnu.org>,
 42966 <at> debbugs.gnu.org
Subject: Re: bug#42966: 28.0.50; vc-dir: wrong backend
Date: Sat, 24 Oct 2020 02:53:35 +0300
Hi Michael,

On 18.10.2020 10:38, Michael Albinus wrote:

>> I don't have a strong opinion on the remote performance, but we might
>> want to ask Michael. Looking at the code, it seems to have forced him
>> to unfortunate measures in the past (such as adding said caching to
>> vc-git-root).
> 
> I didn't follow the thread closely. Could you pls explain, what you find
> unfortunate in Tramp, and how to fix it?

Not in Tramp, but I see an old change in VC that was most likely 
informed by a performance problem in Tramp.

See the commit a40c87a0093. It adds caching of the result of vc-git-root 
to a VC property 'git-root' on the file name.

There are a couple problems with that:

- If FILE is a directory, this cache will never be invalidated (for 
plain files, vc-file-clearprops is called from a number of functions, 
including vc-refresh-state).

- We don't do this for any other backends, which leads to 
inconsistencies in behavior, as well as surprising results, like when we 
did that performance test earlier. I think this is the reason for it.

If we did this uniformly for all backends, we could perhaps find better 
opportunities for caching and invalidation.

But before we look into that, could you try reproducing the original 
problem?

Does the change below still make some scenario perceptibly slower?

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index b1880c0f7b..91554bb6d8 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1573,8 +1573,7 @@ vc-git-extra-menu
 (defun vc-git-extra-status-menu () vc-git-extra-menu-map)

 (defun vc-git-root (file)
-  (or (vc-file-getprop file 'git-root)
-      (vc-file-setprop file 'git-root (vc-find-root file ".git"))))
+  (vc-find-root file ".git"))

 ;; grep-compute-defaults autoloads grep.
 (declare-function grep-read-regexp "grep" ())




This bug report was last modified 4 years and 203 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.