(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))
;; 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))
: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'.