git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] cg-commit: fix signed off handling

From
Jonas Fonseca <fonseca@diku.dk>
Date
Aug 25, 2006, 00:27 UTC
Message-ID
<20060825002740.GH2817@diku.dk>

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
Next: Petr Baudis
Message 1 of 4 in “cg-commit: fix signed off handling”
  1. cg-commit: fix signed off handlingJonas Fonseca, Aug 25, 2006
  2. Petr BaudisSep 24, 2006
  3. Jonas FonsecaSep 24, 2006
  4. Petr BaudisSep 24, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.