Don't use diff-mode buffer as a patch when it's visiting a file (bug#59962)

* lisp/vc/vc.el (vc-deduce-fileset-1): Don't call diff-vc-deduce-fileset
for diff-mode when buffer-file-name is non-nil.  This is because in this case
a file with a diff might be committed to VCS.  So don't use it as a patch
to commit with 'C-x v v'.
This commit is contained in:
Juri Linkov 2022-12-11 19:24:34 +02:00
parent 87475f4af2
commit 733cdeabfb

View file

@ -1135,7 +1135,7 @@ BEWARE: this function may change the current buffer."
(vc-dir-deduce-fileset state-model-only-files))
((derived-mode-p 'dired-mode)
(dired-vc-deduce-fileset state-model-only-files not-state-changing))
((derived-mode-p 'diff-mode)
((and (derived-mode-p 'diff-mode) (not buffer-file-name))
(diff-vc-deduce-fileset))
((setq backend (vc-backend buffer-file-name))
(if state-model-only-files