git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku.dk>
To: git@vger.kernel.org
Subject: [PATCH] cg-commit: fix signed off handling
Date: Fri, 25 Aug 2006 02:27:40 +0200	[thread overview]
Message-ID: <20060825002740.GH2817@diku.dk> (raw)

Handle the sign off insertion before starting the CG: comment lines. Also,
fix typo in grepping for existing sign off lines.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---

The late calling of the add_signoff function has multiple problems,
since at that point comment lines has already been added and the sign
off line will end up in only one of the log message files.

 cg-commit |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/cg-commit b/cg-commit
index 5cebd81..b0b5c34 100755
--- a/cg-commit
+++ b/cg-commit
@@ -406,12 +406,10 @@ # Always have at least one blank line, t
 # the poor people whose text editor has no 'O' command.
 [ "$written" ] || { tty -s && echo >>"$LOGMSG"; }
 
-add_signoff() {
-	if [ "$signoff" ] && ! grep -q -i "signed-off-by: $signoff" $LOGMSG; then
-		grep -q -i sign-off-by $LOGMSG || echo
-		echo "Signed-off-by: $signoff"
-	fi >> $LOGMSG
-}
+if [ "$signoff" ] && ! grep -q -i "signed-off-by: $signoff" $LOGMSG; then
+	grep -q -i signed-off-by $LOGMSG || echo
+	echo "Signed-off-by: $signoff"
+fi >> $LOGMSG
 
 # CG: -----------------------------------------------------------------------
 editor_comment_start commit
@@ -472,7 +470,6 @@ editor_msg_end
 
 cp "$LOGMSG" "$LOGMSG2"
 if tty -s; then
-	add_signoff
 	if [ "$editor" ] && ! editor $commitalways commit c; then
 		rm "$LOGMSG" "$LOGMSG2"
 		[ "$review" ] && rm "$PATCH"
@@ -503,7 +500,6 @@ __END__
 	editor_parse_setif GIT_AUTHOR_DATE Date
 else
 	cat >>"$LOGMSG2"
-	add_signoff
 fi
 
 if [ ! "$review" ]; then
-- 
Jonas Fonseca

             reply	other threads:[~2006-08-25  0:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-25  0:27 Jonas Fonseca [this message]
2006-09-24 17:45 ` [PATCH] cg-commit: fix signed off handling Petr Baudis
2006-09-24 18:32   ` Jonas Fonseca
2006-09-24 20:05     ` Petr Baudis

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

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

  git send-email \
    --in-reply-to=20060825002740.GH2817@diku.dk \
    --to=fonseca@diku.dk \
    --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.
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 NNTP newsgroup(s).