summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2023-01-02 23:08:39 -0700
committerSean Whitton <spwhitton@spwhitton.name>2023-01-02 23:26:23 -0700
commitde3df3bc51e056d179e572fc0fc3bed89b372662 (patch)
tree43eccd88f56cc323e7467f2f6512601626cbbf03
parent6dd3e352f44eb402c9b76c8f6e5bef032317cc55 (diff)
downloademacs-de3df3bc51e056d179e572fc0fc3bed89b372662.tar.gz
* lisp/vc/vc-git.el (vc-git-checkin): Pass vc-git-diff-switches.
-rw-r--r--lisp/vc/vc-git.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 7413ecb79b1..06bf927831d 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -992,6 +992,8 @@ It is based on `log-edit-mode', and has Git-specific extensions."
(let ((vc-git-patch-string patch-string))
(vc-git-checkin nil comment)))
+(autoload 'vc-switches "vc")
+
(defun vc-git-checkin (files comment &optional _rev)
(let* ((file1 (or (car files) default-directory))
(root (vc-git-root file1))
@@ -1021,7 +1023,14 @@ It is based on `log-edit-mode', and has Git-specific extensions."
;; currently staged to the index. So remove the whole file diff
;; from the patch because commit will take it from the index.
(with-temp-buffer
- (vc-git-command (current-buffer) t nil "diff" "--cached")
+ ;; If the user has switches like -D, -M etc. in their
+ ;; `vc-git-diff-switches', we must pass them here too, or
+ ;; our string matches will fail.
+ (if vc-git-diff-switches
+ (apply #'vc-git-command (current-buffer) t nil
+ "diff" "--cached" (vc-switches 'git 'diff))
+ ;; Following code doesn't understand plain diff(1) output.
+ (user-error "Cannot commit patch with nil `vc-git-diff-switches'"))
(goto-char (point-min))
(let ((pos (point)) file-diff file-beg)
(while (not (eobp))
@@ -1291,8 +1300,6 @@ This prompts for a branch to merge from."
:type 'boolean
:version "26.1")
-(autoload 'vc-switches "vc")
-
(defun vc-git-print-log (files buffer &optional shortlog start-revision limit)
"Print commit log associated with FILES into specified BUFFER.
If SHORTLOG is non-nil, use a short format based on `vc-git-root-log-format'.