Subject: Re: bug#59962: 29.0.60; vc commands fail in diff-mode

From: Juri Linkov <[email-masked]>
Date: Sun, 11 Dec 2022 19:28:06 +0200

>> As a distribution maintainer, I find myself working with
>> version-controlled patches which Emacs visits in diff-mode.
>> Unfortunately, there is a bad interaction between diff-mode and vc,
>> which makes all vc commands fail.  This is what I got on C-x v l:
>>
>> ,----
>> | Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
>> |   file-truename(nil)
>> |   find-buffer-visiting(nil)
>> |   vc-buffer-sync-fileset((Git (nil nil nil nil) nil nil patch) t)
>> |   vc-diff(nil t)
>> |   funcall-interactively(vc-diff nil t)
>> |   call-interactively(vc-diff nil nil)
>> |   command-execute(vc-diff)
>> `----
>
> Could you detail the steps to reproduce this issue (preferably from
> emacs -Q)?  I've tried C-x v l on a few Git-version-controlled .patch
> files (in Diff mode) but I couldn't reproduce the error.  Thanks.

The new feature of using 'C-x v v' on a diff buffer to commit it
as a patch should not be used when the diff buffer is vc-controlled.
This also means that 'C-x v v' on a file that even is not yet
vc-controlled, after the recent fix will register the file in vcs,
instead of committing it as a patch.  'C-x v v' for committing
the patch will be supported only on non-file buffers.