# HG changeset patch # User Dan Nicolaescu # Date 1248326247 0 # Node ID 1416a5bb935360ace4b7c8529b7a8be302e0e199 # Parent 7d9bf219df36731e7e8d6960646a1b794e3727b3 (vc-git-add-signoff): New variable. (vc-git-checkin): Use it. (vc-git-toggle-signoff): New function. (vc-git-extra-menu-map): Bind it to menu. diff -r 7d9bf219df36 -r 1416a5bb9353 lisp/ChangeLog --- a/lisp/ChangeLog Thu Jul 23 02:56:06 2009 +0000 +++ b/lisp/ChangeLog Thu Jul 23 05:17:27 2009 +0000 @@ -1,3 +1,10 @@ +2009-07-22 Dan Nicolaescu + + * vc-git.el (vc-git-add-signoff): New variable. + (vc-git-checkin): Use it. + (vc-git-toggle-signoff): New function. + (vc-git-extra-menu-map): Bind it to menu. + 2009-07-23 Glenn Morris * help-fns.el (describe-variable): Describe ignored and risky local diff -r 7d9bf219df36 -r 1416a5bb9353 lisp/vc-git.el --- a/lisp/vc-git.el Thu Jul 23 02:56:06 2009 +0000 +++ b/lisp/vc-git.el Thu Jul 23 05:17:27 2009 +0000 @@ -118,6 +118,13 @@ :version "23.1" :group 'vc) +(defcustom vc-git-add-signoff nil + "Add a Signed-off-by line when committing." + :type 'boolean + :version "23.2" + :group 'vc) + + (defvar git-commits-coding-system 'utf-8 "Default coding system for git commits.") @@ -420,7 +427,8 @@ (defun vc-git-checkin (files rev comment) (let ((coding-system-for-write git-commits-coding-system)) - (vc-git-command nil 0 files "commit" "-m" comment "--only" "--"))) + (vc-git-command nil 0 files "commit" + (if vc-git-add-signoff "-s" "") "-m" comment "--only" "--"))) (defun vc-git-find-revision (file rev buffer) (let ((coding-system-for-read 'binary) @@ -633,12 +641,20 @@ (define-key map [git-grep] '(menu-item "Git grep..." vc-git-grep :help "Run the `git grep' command")) + (define-key map [git-sig] + '(menu-item "Add Signed-off-by on commit" vc-git-toggle-signoff + :help "Add Add Signed-off-by when commiting (i.e. add the -s flag)" + :button (:toggle . vc-git-add-signoff))) map)) (defun vc-git-extra-menu () vc-git-extra-menu-map) (defun vc-git-extra-status-menu () vc-git-extra-menu-map) +(defun vc-git-toggle-signoff () + (interactive) + (setq vc-git-add-signoff (not vc-git-add-signoff))) + ;; Derived from `lgrep'. (defun vc-git-grep (regexp &optional files dir) "Run git grep, searching for REGEXP in FILES in directory DIR.