diff options
| author | Sean Whitton | 2022-12-20 15:53:19 -0700 |
|---|---|---|
| committer | Sean Whitton | 2022-12-22 13:37:12 -0700 |
| commit | baaa9f42e574aa5eceeb4b9354a42ccb8ff1969a (patch) | |
| tree | 89b81f76547411004352c7c0b75a94cc1ef96141 | |
| parent | 0754173c923a1888a1b18b4c6c5d1dc72e6cc6af (diff) | |
| download | emacs-baaa9f42e574aa5eceeb4b9354a42ccb8ff1969a.tar.gz emacs-baaa9f42e574aa5eceeb4b9354a42ccb8ff1969a.zip | |
vc-git-checkin: Don't try to apply an empty patch
* lisp/vc/vc-git.el (vc-git-checkin): Don't try to apply an empty
patch to the index, because in that case 'git apply' fails.
(cherry picked from commit 1424342225ef5b18c630364dd88e004f4ebb1c7f)
| -rw-r--r-- | lisp/vc/vc-git.el | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index b5959d535c0..afaaa44e908 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el | |||
| @@ -1041,12 +1041,13 @@ It is based on `log-edit-mode', and has Git-specific extensions." | |||
| 1041 | (string-replace file-diff "" vc-git-patch-string)) | 1041 | (string-replace file-diff "" vc-git-patch-string)) |
| 1042 | (user-error "Index not empty")) | 1042 | (user-error "Index not empty")) |
| 1043 | (setq pos (point)))))) | 1043 | (setq pos (point)))))) |
| 1044 | (let ((patch-file (make-nearby-temp-file "git-patch"))) | 1044 | (unless (string-empty-p vc-git-patch-string) |
| 1045 | (with-temp-file patch-file | 1045 | (let ((patch-file (make-nearby-temp-file "git-patch"))) |
| 1046 | (insert vc-git-patch-string)) | 1046 | (with-temp-file patch-file |
| 1047 | (unwind-protect | 1047 | (insert vc-git-patch-string)) |
| 1048 | (vc-git-command nil 0 patch-file "apply" "--cached") | 1048 | (unwind-protect |
| 1049 | (delete-file patch-file)))) | 1049 | (vc-git-command nil 0 patch-file "apply" "--cached") |
| 1050 | (delete-file patch-file))))) | ||
| 1050 | (cl-flet ((boolean-arg-fn | 1051 | (cl-flet ((boolean-arg-fn |
| 1051 | (argument) | 1052 | (argument) |
| 1052 | (lambda (value) (when (equal value "yes") (list argument))))) | 1053 | (lambda (value) (when (equal value "yes") (list argument))))) |