Function: vc-git-prepare-patch

vc-git-prepare-patch is a byte-compiled function defined in vc-git.el.gz.

Signature

(vc-git-prepare-patch REV)

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-git.el.gz
(defun vc-git-prepare-patch (rev)
  (with-current-buffer (generate-new-buffer " *vc-git-prepare-patch*")
    (vc-git-command
     t 0 '()  "format-patch"
     "--no-numbered" "--stdout"
     ;; From gitrevisions(7): ^<n> means the <n>th parent
     ;; (i.e.  <rev>^ is equivalent to <rev>^1). As a
     ;; special rule, <rev>^0 means the commit itself and
     ;; is used when <rev> is the object name of a tag
     ;; object that refers to a commit object.
     (concat rev "^.." rev))
    (let (subject)
      ;; Extract the subject line
      (goto-char (point-min))
      (search-forward-regexp "^Subject: \\(.+\\)")
      (setq subject (match-string 1))
      ;; Jump to the beginning for the patch
      (search-forward-regexp "\n\n")
      ;; Return the extracted data
      (list :subject subject
            :buffer (current-buffer)
            :body-start (point)))))