@matheusbsbs / matheus-bagliano / commits / 6fb204266c
Fork 0

git.el: Simplify handling of merge heads in the commit log-edit buffer.

Use a single Merge: header instead of one Parent: header for each parent, and don't list the current HEAD as a merged head. Support symbolic references too. Signed-off-by: Alexandre Julliard <julliard@winehq.org>

Alexandre Julliard committed Aug 2, 2008 at 18:04 UTC 6fb204266cc985284b554e9f9f1894ec8360b2f5
1 file changed +7 -8
contrib/emacs/git.el
+7 -8
@@ -173,7 +173,7 @@ if there is already one that displays the same directory."
173 (defconst git-log-msg-separator "--- log message follows this line ---")
174
175 (defvar git-log-edit-font-lock-keywords
176 - `(("^\\(Author:\\|Date:\\|Parent:\\|Signed-off-by:\\)\\(.*\\)$"
176 + `(("^\\(Author:\\|Date:\\|Merge:\\|Signed-off-by:\\)\\(.*\\)$"
177 (1 font-lock-keyword-face)
178 (2 font-lock-function-name-face))
179 (,(concat "^\\(" (regexp-quote git-log-msg-separator) "\\)$")
@@ -433,11 +433,11 @@ the process output as a string, or nil if the git command failed."
433 (when (re-search-forward "^Date: +\\(.*\\)$" nil t)
434 (setq author-date (match-string 1)))
435 (goto-char (point-min))
436 - (while (re-search-forward "^Parent: +\\([0-9a-f]+\\)" nil t)
437 - (unless (string-equal head (match-string 1))
438 - (setq subject "commit (merge): ")
436 + (when (re-search-forward "^Merge: +\\(.*\\)" nil t)
437 + (setq subject "commit (merge): ")
438 + (dolist (parent (split-string (match-string 1) " +" t))
439 (push "-p" args)
440 - (push (match-string 1) args))))
440 + (push parent args))))
441 (setq log-start (point-min)))
442 (setq log-end (point-max))
443 (goto-char log-start)
@@ -1253,9 +1253,8 @@ Return the list of files that haven't been handled."
1253 (or author-email committer-email)
1254 (if date (format "Date: %s\n" date) "")
1255 (if merge-heads
1256 - (format "Parent: %s\n%s\n"
1257 - (git-rev-parse "HEAD")
1258 - (mapconcat (lambda (str) (concat "Parent: " str)) merge-heads "\n"))
1256 + (format "Merge: %s\n"
1257 + (mapconcat 'identity merge-heads " "))
1258 ""))
1259 'face 'git-header-face)
1260 (propertize git-log-msg-separator 'face 'git-separator-face)