3939; ; - hook into file save (after-save-hook)
4040; ; - diff against other branch
4141; ; - renaming files from the status buffer
42- ; ; - support for appending signed-off-by
4342; ; - creating tags
4443; ; - fetch/pull
4544; ; - switching branches
@@ -103,6 +102,9 @@ If not set, fall back to `add-log-mailing-address' and then `user-mail-address'.
103102(defvar git-commits-coding-system 'utf-8
104103 " Default coding system for git commits." )
105104
105+ (defvar git-append-signed-off-by nil
106+ " Whether to append a Signed-off-by line to the commit message." )
107+
106108(defconst git-log-msg-separator " --- log message follows this line ---" )
107109
108110(defconst git-per-dir-ignore-file " .gitignore"
@@ -792,7 +794,8 @@ If not set, fall back to `add-log-mailing-address' and then `user-mail-address'.
792794 (unless git-status (error " Not in git-status buffer. " ))
793795 (let ((buffer (get-buffer-create " *git-commit*" ))
794796 (merge-heads (git-get-merge-heads))
795- (dir default-directory))
797+ (dir default-directory)
798+ (sign-off git-append-signed-off-by))
796799 (with-current-buffer buffer
797800 (when (eq 0 (buffer-size ))
798801 (cd dir)
@@ -809,10 +812,13 @@ If not set, fall back to `add-log-mailing-address' and then `user-mail-address'.
809812 'face 'git-header-face )
810813 (propertize git-log-msg-separator 'face 'git-separator-face )
811814 " \n " )
812- (when (and merge-heads (file-readable-p " .git/MERGE_MSG" ))
813- (insert-file-contents " .git/MERGE_MSG" ))))
815+ (cond ((and merge-heads (file-readable-p " .git/MERGE_MSG" ))
816+ (insert-file-contents " .git/MERGE_MSG" ))
817+ (sign-off
818+ (insert (format " \n\n Signed-off-by: %s <%s >\n "
819+ (git-get-committer-name) (git-get-committer-email)))))))
814820 (let ((log-edit-font-lock-keywords
815- `((" ^\\ (Author:\\ |Date:\\ |Parent:\\ )\\ (.*\\ )"
821+ `((" ^\\ (Author:\\ |Date:\\ |Parent:\\ |Signed-off-by: \\ )\\ (.*\\ )"
816822 (1 font-lock-keyword-face )
817823 (2 font-lock-function-name-face ))
818824 (,(concat " ^\\ (" (regexp-quote git-log-msg-separator) " \\ )$" )
0 commit comments