{"thread":{"id":"7185","subject":"[PATCH 2/2] git.el: Retrieve commit log information from .dotest directory.","startedAt":"2007-03-10T18:22:26Z","lastAt":"2007-03-10T18:22:26Z","messageCount":1,"participants":["Alexandre Julliard"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"36753","messageId":"87lki5557h.fsf@wine.dyndns.org","threadId":"7185","inReplyTo":null,"subject":"[PATCH 2/2] git.el: Retrieve commit log information from .dotest directory.","fromName":"Alexandre Julliard","fromEmail":"julliard@winehq.org","sentAt":"2007-03-10T18:22:26Z","receivedAt":"2007-03-10T18:22:26Z","isPatch":true,"sender":{"key":"julliard@winehq.org","avatar":null},"body":"If a git-am or git-rebase is in progress, fill the commit log buffer\nfrom the commit information found in the various files in the .dotest\ndirectory.\n\nSigned-off-by: Alexandre Julliard <julliard@winehq.org>\n---\n contrib/emacs/git.el |   77 ++++++++++++++++++++++++++++++++++---------------\n 1 files changed, 53 insertions(+), 24 deletions(-)\n\ndiff --git a/contrib/emacs/git.el b/contrib/emacs/git.el\nindex 427f89b..db87a37 100644\n--- a/contrib/emacs/git.el\n+++ b/contrib/emacs/git.el\n@@ -903,36 +903,65 @@ and returns the process output as a string.\"\n       (goto-char (point-max))\n       (insert sign-off \"\\n\"))))\n \n-(defun git-commit-file ()\n-  \"Commit the marked file(s), asking for a commit message.\"\n-  (interactive)\n+(defun git-setup-log-buffer (buffer &optional author-name author-email subject date msg)\n+  \"Setup the log buffer for a commit.\"\n   (unless git-status (error \"Not in git-status buffer.\"))\n-  (let ((buffer (get-buffer-create \"*git-commit*\"))\n-        (merge-heads (git-get-merge-heads))\n+  (let ((merge-heads (git-get-merge-heads))\n         (dir default-directory)\n-        (coding-system (git-get-commits-coding-system))\n         (committer-name (git-get-committer-name))\n         (committer-email (git-get-committer-email))\n         (sign-off git-append-signed-off-by))\n     (with-current-buffer buffer\n-      (when (eq 0 (buffer-size))\n-        (cd dir)\n-        (erase-buffer)\n-        (insert\n-         (propertize\n-          (format \"Author: %s <%s>\\n%s\"\n-                  committer-name committer-email\n-                  (if merge-heads\n-                      (format \"Parent: %s\\n%s\\n\"\n-                              (git-rev-parse \"HEAD\")\n-                              (mapconcat (lambda (str) (concat \"Parent: \" str)) merge-heads \"\\n\"))\n-                    \"\"))\n-          'face 'git-header-face)\n-         (propertize git-log-msg-separator 'face 'git-separator-face)\n-         \"\\n\")\n-        (when (file-readable-p \".git/MERGE_MSG\")\n-          (insert-file-contents \".git/MERGE_MSG\"))\n-        (when sign-off (git-append-sign-off committer-name committer-email))))\n+      (cd dir)\n+      (erase-buffer)\n+      (insert\n+       (propertize\n+        (format \"Author: %s <%s>\\n%s%s\"\n+                (or author-name committer-name)\n+                (or author-email committer-email)\n+                (if date (format \"Date: %s\\n\" date) \"\")\n+                (if merge-heads\n+                    (format \"Parent: %s\\n%s\\n\"\n+                            (git-rev-parse \"HEAD\")\n+                            (mapconcat (lambda (str) (concat \"Parent: \" str)) merge-heads \"\\n\"))\n+                  \"\"))\n+        'face 'git-header-face)\n+       (propertize git-log-msg-separator 'face 'git-separator-face)\n+       \"\\n\")\n+      (when subject (insert subject \"\\n\\n\"))\n+      (cond (msg (insert msg \"\\n\"))\n+            ((file-readable-p \".dotest/msg\")\n+             (insert-file-contents \".dotest/msg\"))\n+            ((file-readable-p \".git/MERGE_MSG\")\n+             (insert-file-contents \".git/MERGE_MSG\")))\n+      ; delete empty lines at end\n+      (goto-char (point-min))\n+      (when (re-search-forward \"\\n+\\\\'\" nil t)\n+        (replace-match \"\\n\" t t))\n+      (when sign-off (git-append-sign-off committer-name committer-email)))))\n+\n+(defun git-commit-file ()\n+  \"Commit the marked file(s), asking for a commit message.\"\n+  (interactive)\n+  (unless git-status (error \"Not in git-status buffer.\"))\n+  (let ((buffer (get-buffer-create \"*git-commit*\"))\n+        (coding-system (git-get-commits-coding-system))\n+        author-name author-email subject date)\n+    (when (eq 0 (buffer-size buffer))\n+      (when (file-readable-p \".dotest/info\")\n+        (with-temp-buffer\n+          (insert-file-contents \".dotest/info\")\n+          (goto-char (point-min))\n+          (when (re-search-forward \"^Author: \\\\(.*\\\\)\\nEmail: \\\\(.*\\\\)$\" nil t)\n+            (setq author-name (match-string 1))\n+            (setq author-email (match-string 2)))\n+          (goto-char (point-min))\n+          (when (re-search-forward \"^Subject: \\\\(.*\\\\)$\" nil t)\n+            (setq subject (match-string 1)))\n+          (goto-char (point-min))\n+          (when (re-search-forward \"^Date: \\\\(.*\\\\)$\" nil t)\n+            (setq date (match-string 1)))))\n+      (git-setup-log-buffer buffer author-name author-email subject date))\n     (log-edit #'git-do-commit nil #'git-log-edit-files buffer)\n     (setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords))\n     (setq buffer-file-coding-system coding-system)\n-- \n1.5.0.3.321.g4253\n\n-- \nAlexandre Julliard\njulliard@winehq.org\n"}]}