From: Dmitry Gutov <dgutov@yandex.ru>
To: 11757@debbugs.gnu.org
Subject: bug#11757: Acknowledgement (24.1.50; vc-git calls `process-file' too many times)
Date: Sun, 01 Jul 2012 18:58:01 +0400 [thread overview]
Message-ID: <4FF06579.4000101@yandex.ru> (raw)
In-Reply-To: <87pq8f4xbv.fsf@gmx.de>
Sorry, forgot to cc.
On 01.07.2012 13:58, Michael Albinus wrote:
> Dmitry Gutov <dgutov@yandex.ru> writes:
>
>>>> I'm not sure what we should do. Call (vc-mode-line) anyway? That would work.
>>>
>>> Nope. This is expansive, because it recomputes `vc-working-revision'. We
>>> would loose all improvements from using the cache.
>>
>> I don't think so.
>>
>> If we hadn't reset all properties in vc-before-save (file existed),
>> nothing changes.
>> If we did reset them, then yes, vc-working-revision will recompute
>> vc-working-revision property, but only once after the reset.
>> Which is what we want to do anyway, since the file's state has
>> changed, and the working revision could have changed as well, so we
>> need to know them to update mode-line.
>
> Likely, the best option is to call (vc-registered file) after clearing
> the file cache. This recomputes the 'vc-backend property as well, what
> we want.
Have you tried this? (vc-backend file) gets called just a bit later, in
`vc-after-save`, and it calls `vc-registered' in turn, but since the
file is no longer registered with Git, it returns nil, and the mode-line
is not updated.
Also, I don't think we should call (vc-backend file) before the file is
written to disk.
> Calling (vc-mode-line file) at this point would be for the side-effect
> of that function, which is bad in my experience. It would harden
> maintenance, 'cause nobody will know why we want to refresh the modeline
> at this point.
I meant, always calling (vc-mode-line file) in `vc-after-save', moving
it outside of the (and backend ...) check.
This does have a performance downside with non-VC file buffers, of a
couple additional function calls, 'vc-backend cache lookup, and
unconditional mode-line update.
So from this standpoint, saving and restoring 'vc-backend value around
clearing props in `vc-before-save' might indeed be the best solution.
>> By the way, this last patch I sent doesn't help if the user just
>> removed the file from repository while leaving it on disk (git rm
>> --cached ... && git commit ..., for example), but whatever.
>
> If we use the cache, there will always be a constellation that the cache
> is stale due to external operations. As Stefan said, this is mostly
> uncritical.
I'm bringing attention to these cases because they could be the actual
benefit of your patch (caching 'git-registered) over my initial patch
(not calling `vc-git-registered' from `vc-git-state' at all).
The original code supported these edge cases, at the cost of additional
process call.
-- Dmitry
next prev parent reply other threads:[~2012-07-01 14:58 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-21 2:12 bug#11757: 24.1.50; vc-git calls `process-file' too many times Dmitry Gutov
[not found] ` <handler.11757.B.13402450035158.ack@debbugs.gnu.org>
2012-06-26 10:54 ` bug#11757: Acknowledgement (24.1.50; vc-git calls `process-file' too many times) Dmitry Gutov
2012-06-26 12:14 ` Michael Albinus
2012-06-28 0:51 ` Dmitry Gutov
2012-06-29 13:46 ` Michael Albinus
2012-06-29 16:06 ` Dmitry Gutov
2012-06-29 16:40 ` Michael Albinus
2012-06-29 17:03 ` Dmitry Gutov
2012-06-29 17:38 ` Michael Albinus
2012-06-30 9:03 ` Michael Albinus
2012-06-30 12:56 ` Dmitry Gutov
2012-06-30 13:19 ` Michael Albinus
2012-06-30 17:42 ` Dmitry Gutov
2012-06-30 18:46 ` Michael Albinus
2012-06-30 19:14 ` Dmitry Gutov
2012-07-01 9:58 ` Michael Albinus
2012-07-01 14:58 ` Dmitry Gutov [this message]
[not found] ` <4FF062D7.7050402@yandex.ru>
[not found] ` <878vf2sf7q.fsf@gmx.de>
2012-07-02 12:42 ` Dmitry Gutov
2012-07-02 12:44 ` Dmitry Gutov
2012-07-04 15:10 ` Michael Albinus
2012-07-04 16:42 ` Dmitry Gutov
2012-07-06 13:44 ` Michael Albinus
2012-07-06 15:55 ` Dmitry Gutov
[not found] ` <5000D21F.6080900@yandex.ru>
[not found] ` <87k3y36gbe.fsf@gmx.de>
[not found] ` <50046AD3.1080605@yandex.ru>
[not found] ` <87y5min9ad.fsf@gmx.de>
[not found] ` <50063692.7080707@yandex.ru>
2012-07-18 14:38 ` Michael Albinus
2012-07-18 17:01 ` Dmitry Gutov
2012-06-30 23:01 ` Stefan Monnier
2012-06-30 23:38 ` Dmitry Gutov
2012-07-18 14:11 ` bug#11757: Fwd: " Michael Albinus
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FF06579.4000101@yandex.ru \
--to=dgutov@yandex.ru \
--cc=11757@debbugs.gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.