git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] hooks/commit-msg: add example to add Signed-off-by line to message
Date: Thu, 21 Dec 2006 09:24:17 +0000	[thread overview]
Message-ID: <200612210924.17357.andyparkins@gmail.com> (raw)
In-Reply-To: <7vejqufonm.fsf@assigned-by-dhcp.cox.net>

After checking to see if the commit message already has the target
signed-off-by (for example in --amend commits), this patch generates a
signed off by line from the repository owner and adds it to the commit
message.

Based on Johannes Schindelin's earlier patch to perform the same
function.

Originally, this was done in the pre-commit hook but Junio pointed out
that the commit-msg hook allows the message to be edited.  This has the
aditional advantage that the commit-msg hook gets passed the name of the
message file as a parameter, so it doesn't have to figure out GIT_DIR for
itself.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 templates/hooks--commit-msg |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/templates/hooks--commit-msg b/templates/hooks--commit-msg
index 0b906ca..ce76bdf 100644
--- a/templates/hooks--commit-msg
+++ b/templates/hooks--commit-msg
@@ -8,6 +8,11 @@
 #
 # To enable this hook, make this file executable.
 
+# Uncomment the below to add a Signed-off-by line to the message.
+#SOB=$(git var GIT_AUTHOR_IDENT | \
+#	sed -n "s/^\(.*\) [0-9]\+ [-+][0-9]\+$/Signed-off-by: \1/p")
+#grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
+
 # This example catches duplicate Signed-off-by lines.
 
 test "" = "$(grep '^Signed-off-by: ' "$1" |
-- 
1.4.4.2.g120e3

  parent reply	other threads:[~2006-12-21  9:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-29 11:20 [PATCH] hooks/pre-commit: add example to add Signed-off-by line to message Johannes Schindelin
2006-12-20 15:54 ` Andy Parkins
2006-12-20 16:04 ` Andy Parkins
2006-12-20 16:18   ` Johannes Schindelin
2006-12-20 17:29     ` Junio C Hamano
2006-12-20 17:37       ` Johannes Schindelin
2006-12-20 17:44         ` Junio C Hamano
2006-12-21  8:26           ` Johannes Schindelin
2006-12-21  9:24           ` Andy Parkins [this message]
2006-12-22  5:45             ` [PATCH] hooks/commit-msg: " Junio C Hamano
2006-12-22  9:28               ` Andy Parkins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200612210924.17357.andyparkins@gmail.com \
    --to=andyparkins@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).