summaryrefslogtreecommitdiff
path: root/lisp/vc/vc.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/vc/vc.el')
-rw-r--r--lisp/vc/vc.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 597a1622f5a..fce98d091bf 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1302,6 +1302,17 @@ from which to check out the file(s)."
;; Fileset comes from a diff-mode buffer, see
;; 'diff-vc-deduce-fileset', and the buffer is the patch to apply.
((eq model 'patch)
+ (when (buffer-narrowed-p)
+ ;; If user used `diff-restrict-view' then we may not have the
+ ;; file header, and the commit will not succeed (bug#73387).
+ (user-error "Cannot commit patch when narrowed; consider %s"
+ (mapconcat (lambda (c)
+ (key-description
+ (where-is-internal c nil t)))
+ '(widen
+ diff-delete-other-hunks
+ vc-next-action)
+ " ")))
(vc-checkin files backend nil nil nil (buffer-string)))
((or (null state) (eq state 'unregistered))
(cond (verbose