Subject: bug#26345: [PATCH] Handle renamed files when cycling through revisions

From: Sean Whitton <[email-masked]>
Date: Sat, 05 Jul 2025 17:42:04 +0100

Hello,

On Mon 30 Jun 2025 at 10:29pm +02, Jakub Ječmínek via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> * lisp/vc/vc-git.el (vc-git-registered,vc-git-annotate-command):
> Update the FILE argument passed to 'vc-git-annotate-command'
> based on whether FILE exists in the current revision. If it
> doesn't, look up its new name. (Bug#26345)
> ---
> What do you think about the patch below?

Thanks for posting this.

We can't add an optional argument to vc-git-registered directly because
that's the vc-git implementation for the `registered' backend function,
so its lambda list is fixed by the API.  You could get around this by
making vc-git-registered a tiny wrapper around a function
vc-git--registered which has all the existing code plus the optional
argument.

But is the call to vc-git-registered needed at all?  Why not just look
at the file name changes list immediately, and if the file does not
appear there, assume that the original file name is valid?

And maybe then this could happen up in vc-annotate instead of being
Git-specific.  It's kind of a heuristic anyway.

-- 
Sean Whitton