summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 96a5702)
raw | patch | inline | side by side (parent: 96a5702)
author | Alexandre Julliard <julliard@winehq.org> | |
Sat, 10 Mar 2007 18:21:25 +0000 (19:21 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 11 Mar 2007 05:58:21 +0000 (21:58 -0800) |
Also avoid inserting an extra newline if other signoff lines are
present.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
present.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
contrib/emacs/git.el | patch | blob | history |
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 13d198229bbdf4c56f15bfbe0528c6714106e9e3..427f89b0e10b7222d21d80b3ed0afa05a1f97b2f 100644 (file)
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
(with-current-buffer log-edit-parent-buffer
(git-get-filenames (git-marked-files-state 'added 'deleted 'modified))))
+(defun git-append-sign-off (name email)
+ "Append a Signed-off-by entry to the current buffer, avoiding duplicates."
+ (let ((sign-off (format "Signed-off-by: %s <%s>" name email))
+ (case-fold-search t))
+ (goto-char (point-min))
+ (unless (re-search-forward (concat "^" (regexp-quote sign-off)) nil t)
+ (goto-char (point-min))
+ (unless (re-search-forward "^Signed-off-by: " nil t)
+ (setq sign-off (concat "\n" sign-off)))
+ (goto-char (point-max))
+ (insert sign-off "\n"))))
+
(defun git-commit-file ()
"Commit the marked file(s), asking for a commit message."
(interactive)
(merge-heads (git-get-merge-heads))
(dir default-directory)
(coding-system (git-get-commits-coding-system))
+ (committer-name (git-get-committer-name))
+ (committer-email (git-get-committer-email))
(sign-off git-append-signed-off-by))
(with-current-buffer buffer
(when (eq 0 (buffer-size))
(insert
(propertize
(format "Author: %s <%s>\n%s"
- (git-get-committer-name) (git-get-committer-email)
+ committer-name committer-email
(if merge-heads
(format "Parent: %s\n%s\n"
(git-rev-parse "HEAD")
'face 'git-header-face)
(propertize git-log-msg-separator 'face 'git-separator-face)
"\n")
- (cond ((file-readable-p ".git/MERGE_MSG")
- (insert-file-contents ".git/MERGE_MSG"))
- (sign-off
- (insert (format "\n\nSigned-off-by: %s <%s>\n"
- (git-get-committer-name) (git-get-committer-email)))))))
+ (when (file-readable-p ".git/MERGE_MSG")
+ (insert-file-contents ".git/MERGE_MSG"))
+ (when sign-off (git-append-sign-off committer-name committer-email))))
(log-edit #'git-do-commit nil #'git-log-edit-files buffer)
(setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords))
(setq buffer-file-coding-system coding-system)