Skip to content

Commit 6fb2042

Browse files
committed
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>
1 parent 9ddf6d7 commit 6fb2042

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

contrib/emacs/git.el

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ if there is already one that displays the same directory."
173173
(defconst git-log-msg-separator "--- log message follows this line ---")
174174

175175
(defvar git-log-edit-font-lock-keywords
176-
`(("^\\(Author:\\|Date:\\|Parent:\\|Signed-off-by:\\)\\(.*\\)$"
176+
`(("^\\(Author:\\|Date:\\|Merge:\\|Signed-off-by:\\)\\(.*\\)$"
177177
(1 font-lock-keyword-face)
178178
(2 font-lock-function-name-face))
179179
(,(concat "^\\(" (regexp-quote git-log-msg-separator) "\\)$")
@@ -433,11 +433,11 @@ the process output as a string, or nil if the git command failed."
433433
(when (re-search-forward "^Date: +\\(.*\\)$" nil t)
434434
(setq author-date (match-string 1)))
435435
(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))
439439
(push "-p" args)
440-
(push (match-string 1) args))))
440+
(push parent args))))
441441
(setq log-start (point-min)))
442442
(setq log-end (point-max))
443443
(goto-char log-start)
@@ -1253,9 +1253,8 @@ Return the list of files that haven't been handled."
12531253
(or author-email committer-email)
12541254
(if date (format "Date: %s\n" date) "")
12551255
(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 " "))
12591258
""))
12601259
'face 'git-header-face)
12611260
(propertize git-log-msg-separator 'face 'git-separator-face)

0 commit comments

Comments
 (0)