Subject: Re: bug#11757: Acknowledgement (24.1.50; vc-git calls `process-file' too many times)

From: Michael Albinus <[email-masked]>
Date: Wed, 18 Jul 2012 16:38:27 +0200

Dmitry Gutov <[email-masked]> writes:

> So I'm just doing one scenario now. If you write a different one, I
> can do that next.
>
> Scenario:
> 1. git init test (outside of Emacs)
> 2. find-file in this directory (creating the new file)
> 3. edit, save, `vc-next-action' (registering the new file)
> 4. repeat step 3 (makes first commit)
> 5. repeat step 4 (makes second commit)
> 6. `vc-rename-file'
> 7. `vc-next-action' (commit)
> 8. `vc-delete-file'

This scenario seems to be sufficient.

> Done this twice, logs 1 and 3 - without the patch, 2 and 4 - with the
> patch. 1 ~ 3 and 2 ~ 4, so you may just as well compare only one pair.
>
> The difference: a few getprop/setprop calls, and one full uncached
> vc-git-registered' call in `vc-register' (after "git add" was called),
> all in favor of the patched version (which doesn't make the above
> calls).

Yes. Just naively counting `process-file' calls, the unpatched version
uses 27 calls, and the patched version needs 26. This is likely, because
the patched version doesn't call `vc-git-registered' in `vc-git-state'.

> This would have been different if the file existed and was registered
> in the repository before step 2, then the first call to
> vc-git-registered' would have returned `t' in both versions.

Likely, it doesn't matter. Such a scenario is not what we can expect to
happen often (open an unregistered file in Emacs, it is registered
outside Emacs, and we try to register it inside Emacs). It will result
in an error, that's it.

Finally, I will apply your patch to vc-git.el. Thanks for all your
tests!

> P.S. `ediff' says there are no differences after around 43% mark, but
> there are. For example, line 1021 in trace-3.log shows a call to
> vc-git-registered', whereas the respective line 979 in trace-4.log
> shows that the call is skipped.

No problem here. That chunk is shown to me by ediff.

> --Dmitry

Best regards, Michael.