Cleanup commit message before committing.

Insert merge message and status information into log edit buffer.
This commit is contained in:
Marius Vollmer 2008-08-05 22:30:10 +03:00
parent de3b615a6d
commit cb83f79461

17
mgit.el
View file

@ -338,8 +338,16 @@
(defvar mgit-pre-log-edit-window-configuration nil)
(defun mgit-log-edit-cleanup ()
(save-excursion
(goto-char (point-min))
(flush-lines "^#")
(goto-char (point-min))
(replace-regexp "[ \t\n]*\\'" "\n")))
(defun mgit-log-edit-commit ()
(interactive)
(mgit-log-edit-cleanup)
(if (> (buffer-size) 0)
(write-region (point-min) (point-max) ".git/mgit-log")
(write-region "(Empty description)" nil ".git/mgit-log"))
@ -358,6 +366,15 @@
(pop-to-buffer buf)
(setq default-directory dir)
(use-local-map mgit-log-edit-map)
(save-excursion
(mgit-log-edit-cleanup)
(if (and (= (buffer-size) 0)
(file-exists-p ".git/MERGE_MSG"))
(insert-file-contents ".git/MERGE_MSG"))
(goto-char (point-max))
(insert "\n")
(mgit-insert-output nil nil
"git" "status"))
(message "Use C-c C-c when done.")))
;;; Misc