From: Juri Linkov Date: Sun, 11 Dec 2022 17:24:34 +0000 (+0200) Subject: Don't use diff-mode buffer as a patch when it's visiting a file (bug#59962) X-Git-Tag: emacs-29.0.90~1235 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=733cdeabfb91520584ab88253292c1451f295bae;p=emacs.git 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'. --- diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 328d33040db..690c907c77e 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -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