summaryrefslogtreecommitdiff
path: root/contrib/emacs
diff options
context:
space:
mode:
authorLibravatar Alexandre Julliard <julliard@winehq.org>2006-03-04 17:38:41 +0100
committerLibravatar Junio C Hamano <junkio@cox.net>2006-03-04 13:46:52 -0800
commit45033ad9e333a8c89e7fe3d6bf75adef043602e7 (patch)
tree84583b921402798f454d25242a82a1406b41efcb /contrib/emacs
parentgit.el: Automatically update .gitignore status. (diff)
downloadtgif-45033ad9e333a8c89e7fe3d6bf75adef043602e7.tar.xz
git.el: Added support for Signed-off-by.
If `git-append-signed-off-by' is non-nil, automatically append a sign-off line to the log message when editing it. Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'contrib/emacs')
-rw-r--r--contrib/emacs/git.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 335dcb2d4a..0b24b4d474 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -39,7 +39,6 @@
;; - hook into file save (after-save-hook)
;; - diff against other branch
;; - renaming files from the status buffer
-;; - support for appending signed-off-by
;; - creating tags
;; - fetch/pull
;; - switching branches
@@ -103,6 +102,9 @@ If not set, fall back to `add-log-mailing-address' and then `user-mail-address'.
(defvar git-commits-coding-system 'utf-8
"Default coding system for git commits.")
+(defvar git-append-signed-off-by nil
+ "Whether to append a Signed-off-by line to the commit message.")
+
(defconst git-log-msg-separator "--- log message follows this line ---")
(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'.
(unless git-status (error "Not in git-status buffer."))
(let ((buffer (get-buffer-create "*git-commit*"))
(merge-heads (git-get-merge-heads))
- (dir default-directory))
+ (dir default-directory)
+ (sign-off git-append-signed-off-by))
(with-current-buffer buffer
(when (eq 0 (buffer-size))
(cd dir)
@@ -809,10 +812,13 @@ If not set, fall back to `add-log-mailing-address' and then `user-mail-address'.
'face 'git-header-face)
(propertize git-log-msg-separator 'face 'git-separator-face)
"\n")
- (when (and merge-heads (file-readable-p ".git/MERGE_MSG"))
- (insert-file-contents ".git/MERGE_MSG"))))
+ (cond ((and merge-heads (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)))))))
(let ((log-edit-font-lock-keywords
- `(("^\\(Author:\\|Date:\\|Parent:\\)\\(.*\\)"
+ `(("^\\(Author:\\|Date:\\|Parent:\\|Signed-off-by:\\)\\(.*\\)"
(1 font-lock-keyword-face)
(2 font-lock-function-name-face))
(,(concat "^\\(" (regexp-quote git-log-msg-separator) "\\)$")