From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#11757: Acknowledgement (24.1.50; vc-git calls `process-file' too many times) Date: Fri, 29 Jun 2012 20:06:56 +0400 Message-ID: <4FEDD2A0.3010300@yandex.ru> References: <4FE2832A.1030308@yandex.ru> <4FE994E8.9020605@yandex.ru> <87zk7qs21q.fsf@gmx.de> <4FEBAAAA.3030102@yandex.ru> <87d34igrie.fsf@gmx.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1340986083 30389 80.91.229.3 (29 Jun 2012 16:08:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 29 Jun 2012 16:08:03 +0000 (UTC) Cc: 11757@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 29 18:08:01 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Skdjf-0002Ie-Qh for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Jun 2012 18:07:56 +0200 Original-Received: from localhost ([::1]:38525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Skdjf-00045b-Lm for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Jun 2012 12:07:55 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkdjX-00044H-JZ for bug-gnu-emacs@gnu.org; Fri, 29 Jun 2012 12:07:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SkdjU-0008S9-3n for bug-gnu-emacs@gnu.org; Fri, 29 Jun 2012 12:07:47 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56065) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkdjT-0008S0-Re for bug-gnu-emacs@gnu.org; Fri, 29 Jun 2012 12:07:44 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Skdnd-0008Om-RK for bug-gnu-emacs@gnu.org; Fri, 29 Jun 2012 12:12:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Jun 2012 16:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11757 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11757-submit@debbugs.gnu.org id=B11757.134098628132228 (code B ref 11757); Fri, 29 Jun 2012 16:12:01 +0000 Original-Received: (at 11757) by debbugs.gnu.org; 29 Jun 2012 16:11:21 +0000 Original-Received: from localhost ([127.0.0.1]:37377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Skdmy-0008Nl-LB for submit@debbugs.gnu.org; Fri, 29 Jun 2012 12:11:20 -0400 Original-Received: from forward3.mail.yandex.net ([77.88.46.8]:60695) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Skdmw-0008Nd-4Y for 11757@debbugs.gnu.org; Fri, 29 Jun 2012 12:11:20 -0400 Original-Received: from smtp1.mail.yandex.net (smtp1.mail.yandex.net [77.88.46.101]) by forward3.mail.yandex.net (Yandex) with ESMTP id 5FA24B42460; Fri, 29 Jun 2012 20:06:54 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1340986014; bh=vBT6prUGz/WRB7pqMTvSgIZSbTel48XHtfbQAgS/HWM=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=jzJz+h/fAGEMUjPBoSlxGijchQIuad+3DZkiGUw//JEAXjw1knn9jDXDOFnkQOuRF k6wUCqhtd7SGEKD5rWUm+jAG4DxQvBIcgJczokb1Itp4ClTUisj0S3nhu/Kl60+eTF JFRLSPWtMf8/I7tRsEad0/2kNVvjcbpihJr1Qpk4= Original-Received: from smtp1.mail.yandex.net (localhost [127.0.0.1]) by smtp1.mail.yandex.net (Yandex) with ESMTP id 3B8B4AA056F; Fri, 29 Jun 2012 20:06:54 +0400 (MSK) Original-Received: from 98-87.nwlink.spb.ru (98-87.nwlink.spb.ru [178.252.98.87]) by smtp1.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 6rA80gbF-6rAibLGf; Fri, 29 Jun 2012 20:06:53 +0400 X-Yandex-Rcpt-Suid: michael.albinus@gmx.de X-Yandex-Rcpt-Suid: 11757@debbugs.gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1340986014; bh=vBT6prUGz/WRB7pqMTvSgIZSbTel48XHtfbQAgS/HWM=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=MUGP9MdVdH4Ibtypp0u+eik0OVG/oTz4G5pfeDPtZLB32f7/WSLxHz4GH90I2Wkss rcpZd7TMdVwNyjeOvUwdIwbnJiTgaOW+C3+4gi3RNuG7JBQpR2ODz8AkOLNO+VRCbO 9X8UZINWC+RecZOfIsQPQbfN72Nj3ZUsP9QrSe00= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 In-Reply-To: <87d34igrie.fsf@gmx.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:61412 Archived-At: On 29.06.2012 17:46, Michael Albinus wrote: >> This little patch shaves 2 `process-file' invocations from both >> vc-find-file-hook' and `vc-after-save'. >> >> It's not fully backward-compatible (it breaks when a previously >> registered file became unregistered), but I think it's a good >> tradeoff. > > I don't know whether we shall break the functionality. Instead of, I've > appended a small patch, which uses the cache for vc-git-registered and > vc-git-root (additionally to your patch, which uses the cache of > vc-working-revision). This reduces already the number of process-file > invocations from 6 to 4, when openening a new file. And there's room for > other caches. Looks like the win is the same here. I'm not sure about caching vc-git-root, since at least in local scenario it's a fast operation. Is it that slow with Tramp? Other backends don't cache it either. >> VC doesn't handle all cases of "outside interference" anyway: for >> example, the cached return value of `vc-working-revision' is >> invalidated only after the file is checked in, moved, or deleted, not >> after each save, and switching to another branch in Git is a much more >> common occurrence. > > A stale cache is bad, of course. We must carefully check, where a cached > value has to be invalidated. But why should vc-working-revision being > invalidated after saving? It is still the same, I believe. Switching to > another branch shall be observed by Emacs, 'cause there is another > version of the file on the disk, and Emacs warns you before editing. This won't happen in following cases: 1) We switch to revision when the opened file is the same. 2) It doesn't exist there. 3) We just delete it from disk from outside of Emacs. So the file isn't changed, and you see no warning or update, even after you write it to disk from Emacs again. And the latter two cases (the last one - with a small modification) are the only situations I can think of when an open buffer in which (vc-git-registered) returned t some time ago (so it has vc-backend property set to Git) now should return nil. But the properties won't be reset, so the cached value will be outdated. Can you describe a scenario in which 'git-registered cached value will be invalidated, and the function will then return nil? P.S. I can't find a way to apply context diff with my current setup, so if it's not too hard, please send a unified one next time. -- Dmitry