]> git.eshelyaron.com Git - emacs.git/commitdiff
Reuse commit message when preparing a single patch
authorPhilip Kaludercic <philipk@posteo.net>
Tue, 13 Feb 2024 10:18:16 +0000 (11:18 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 13 Feb 2024 13:11:39 +0000 (14:11 +0100)
* lisp/vc/vc.el (vc-prepare-patch): Check commit message if only
a single revision was selected.

(cherry picked from commit acc6732ca1d39352f1aae3074ad04564178c0954)

lisp/vc/vc.el

index ca6efeabac25d02447f826fd995220c23f621520..619b469bebb24e1f96383c3b509dbe0925cb5208 100644 (file)
@@ -3623,7 +3623,15 @@ revisions.
 When invoked interactively in a Log View buffer with
 marked revisions, use those."
   (interactive
-   (let ((revs (vc-prepare-patch-prompt-revisions)) to)
+   (let* ((revs (vc-prepare-patch-prompt-revisions))
+          (subject
+           (and (length= revs 1)
+                (plist-get
+                 (vc-call-backend
+                  (vc-responsible-backend default-directory)
+                  'prepare-patch (car revs))
+                 :subject)))
+          to)
      (require 'message)
      (while (null (setq to (completing-read-multiple
                             (format-prompt
@@ -3636,7 +3644,7 @@ marked revisions, use those."
        (sit-for blink-matching-delay))
      (list (string-join to ", ")
            (and (not vc-prepare-patches-separately)
-                (read-string "Subject: " "[PATCH] " nil nil t))
+                (read-string "Subject: " (or subject "[PATCH] ") nil nil t))
            revs)))
   (save-current-buffer
     (let ((patches (mapcar (lambda (rev)