GNU bug report logs -
#11757
24.1.50; vc-git calls `process-file' too many times
Previous Next
Reported by: Dmitry Gutov <dgutov <at> yandex.ru>
Date: Thu, 21 Jun 2012 02:17:02 UTC
Severity: normal
Found in version 24.1.50
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
Full log
Message #62 received at 11757 <at> debbugs.gnu.org (full text, mbox):
On 02.07.2012 13:08, Michael Albinus wrote:
> Dmitry Gutov <dgutov <at> yandex.ru> writes:
>
>>> 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.
>
> Well, I've played with it. Scenario:
I believe both scenarios below would work just as well with my original
patch.
> - Have a git-controlled file on disk
> - Load it in Emacs.
> - Remove it on disk, outside Emacs.
> - Save it from Emacs
>
> In vc-before-save, the file cache is cleared 'cause the file doesn't
> exist any longer. As you said, vc-backend is called afterwards,
> recomputing some of the properties. The file shows the correct modeline,
> "Git:master".
If you just removed it on disk, without committing the change, doing
(vc-state-refresh) would correctly recompute its status as 'removed even
without calling (vc-registered).
That's not the status we have a problem with ('unregistered is).
> 2nd scenario:
>
> - Switch to another branch ("git checkout test")
> - Remove the file on disk, outside Emacs.
> - Save it from Emacs
>
> And now the modeline shows "Git:test", as expected.
Was the file absent in the branch test after checkout? If not, this case
is no different from the first.
Basically, we need a scenario in which `vc-next-action' will need to
call `vc-git-register' on a file that recently has been considered
'up-to-date.
>> So from this standpoint, saving and restoring 'vc-backend value around
>> clearing props in `vc-before-save' might indeed be the best solution.
>
> I believe, we even don't need this. The current code DTRT, and clearing
> the properties happens only when the file has been removed.
I believe we can either not call 'vc-git-registered' from `vc-git-state'
at all (caching 'vc-registered is not needed in this case), or we should
fix some scenario which benefits from us doing that.
The logic is rather complicated there, so I might easily be missing some
examples. If so, please tell.
-- Dmitry
This bug report was last modified 12 years and 362 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.