]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't use diff-mode buffer as a patch when it's visiting a file (bug#59962)
authorJuri Linkov <juri@linkov.net>
Sun, 11 Dec 2022 17:24:34 +0000 (19:24 +0200)
committerJuri Linkov <juri@linkov.net>
Sun, 11 Dec 2022 17:24:34 +0000 (19:24 +0200)
* 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'.

lisp/vc/vc.el

index 328d33040db19b01047cad0821f17a604d5efeaa..690c907c77e0553538b31638a3a2947bce1edcfb 100644 (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