{"thread":{"id":"5378","subject":"[PATCH] cg-commit: fix signed off handling","startedAt":"2006-08-25T00:27:40Z","lastAt":"2006-09-24T20:05:05Z","messageCount":4,"participants":["Jonas Fonseca","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"25872","messageId":"20060825002740.GH2817@diku.dk","threadId":"5378","inReplyTo":null,"subject":"[PATCH] cg-commit: fix signed off handling","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2006-08-25T00:27:40Z","receivedAt":"2006-08-25T00:27:40Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Handle the sign off insertion before starting the CG: comment lines. Also,\nfix typo in grepping for existing sign off lines.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\n\nThe late calling of the add_signoff function has multiple problems,\nsince at that point comment lines has already been added and the sign\noff line will end up in only one of the log message files.\n\n cg-commit |   12 ++++--------\n 1 files changed, 4 insertions(+), 8 deletions(-)\n\ndiff --git a/cg-commit b/cg-commit\nindex 5cebd81..b0b5c34 100755\n--- a/cg-commit\n+++ b/cg-commit\n@@ -406,12 +406,10 @@ # Always have at least one blank line, t\n # the poor people whose text editor has no 'O' command.\n [ \"$written\" ] || { tty -s && echo >>\"$LOGMSG\"; }\n \n-add_signoff() {\n-\tif [ \"$signoff\" ] && ! grep -q -i \"signed-off-by: $signoff\" $LOGMSG; then\n-\t\tgrep -q -i sign-off-by $LOGMSG || echo\n-\t\techo \"Signed-off-by: $signoff\"\n-\tfi >> $LOGMSG\n-}\n+if [ \"$signoff\" ] && ! grep -q -i \"signed-off-by: $signoff\" $LOGMSG; then\n+\tgrep -q -i signed-off-by $LOGMSG || echo\n+\techo \"Signed-off-by: $signoff\"\n+fi >> $LOGMSG\n \n # CG: -----------------------------------------------------------------------\n editor_comment_start commit\n@@ -472,7 +470,6 @@ editor_msg_end\n \n cp \"$LOGMSG\" \"$LOGMSG2\"\n if tty -s; then\n-\tadd_signoff\n \tif [ \"$editor\" ] && ! editor $commitalways commit c; then\n \t\trm \"$LOGMSG\" \"$LOGMSG2\"\n \t\t[ \"$review\" ] && rm \"$PATCH\"\n@@ -503,7 +500,6 @@ __END__\n \teditor_parse_setif GIT_AUTHOR_DATE Date\n else\n \tcat >>\"$LOGMSG2\"\n-\tadd_signoff\n fi\n \n if [ ! \"$review\" ]; then\n-- \nJonas Fonseca\n"},{"id":"27567","messageId":"20060924174519.GW20017@pasky.or.cz","threadId":"5378","inReplyTo":"20060825002740.GH2817@diku.dk","subject":"Re: [PATCH] cg-commit: fix signed off handling","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-09-24T17:45:19Z","receivedAt":"2006-09-24T17:45:19Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, Aug 25, 2006 at 02:27:40AM CEST, I got a letter\nwhere Jonas Fonseca <fonseca@diku.dk> said that...\n> Handle the sign off insertion before starting the CG: comment lines. Also,\n> fix typo in grepping for existing sign off lines.\n> \n> Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n> ---\n> \n> The late calling of the add_signoff function has multiple problems,\n> since at that point comment lines has already been added and the sign\n> off line will end up in only one of the log message files.\n\nWell, the commit that moved this was\n\nCommit: 4cf220db10c0b937f9852513effc5565fcbb4f86\nAuthor: Petr Baudis <pasky@pixie.suse.cz> Thu, 20 Jul 2006 11:37:31 -0400\n\n    * cg-commit:\n\n    Add signoff past the message if getting it from stdin\n\nWhat about this?\n\ndiff --git a/cg-commit b/cg-commit\nindex 43e6c6c..beedb6f 100755\n--- a/cg-commit\n+++ b/cg-commit\n@@ -402,10 +402,6 @@ if [ \"$msgfile\" ]; then\n \twritten=1\n fi\n \n-# Always have at least one blank line, to ease the editing for\n-# the poor people whose text editor has no 'O' command.\n-[ \"$written\" ] || { tty -s && echo >>\"$LOGMSG\"; }\n-\n add_signoff() {\n \tif [ \"$signoff\" ] && ! grep -q -i \"signed-off-by: $signoff\" $LOGMSG; then\n \t\tgrep -q -i sign-off-by $LOGMSG || echo\n@@ -413,6 +409,16 @@ add_signoff() {\n \tfi >> $LOGMSG\n }\n \n+if tty -s; then\n+\t# Always have at least one blank line, to ease the editing for\n+\t# the poor people whose text editor has no 'O' command.\n+\t[ \"$written\" ] || echo >>\"$LOGMSG\"\n+\t# Also, add the signoff line _now_ before spewing out CG: lines.\n+\t# (In case of non-tty input we do it later after taking the actual\n+\t# log message from stdin.)\n+\tadd_signoff\n+fi\n+\n # CG: -----------------------------------------------------------------------\n editor_comment_start commit\n \n@@ -472,7 +478,6 @@ editor_msg_end\n \n cp \"$LOGMSG\" \"$LOGMSG2\"\n if tty -s; then\n-\tadd_signoff\n \tif [ \"$editor\" ] && ! editor $commitalways commit c; then\n \t\trm \"$LOGMSG\" \"$LOGMSG2\"\n \t\t[ \"$review\" ] && rm \"$PATCH\"\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\nlK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n"},{"id":"27570","messageId":"20060924183246.GA695@diku.dk","threadId":"5378","inReplyTo":"20060924174519.GW20017@pasky.or.cz","subject":"Re: [PATCH] cg-commit: fix signed off handling","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2006-09-24T18:32:46Z","receivedAt":"2006-09-24T18:32:46Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Petr Baudis <pasky@suse.cz> wrote Sun, Sep 24, 2006:\n> Dear diary, on Fri, Aug 25, 2006 at 02:27:40AM CEST, I got a letter\n> where Jonas Fonseca <fonseca@diku.dk> said that...\n> > Handle the sign off insertion before starting the CG: comment lines. Also,\n> > fix typo in grepping for existing sign off lines.\n> > \n> > Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n> > ---\n> > \n> > The late calling of the add_signoff function has multiple problems,\n> > since at that point comment lines has already been added and the sign\n> > off line will end up in only one of the log message files.\n> \n> Well, the commit that moved this was\n> \n> Commit: 4cf220db10c0b937f9852513effc5565fcbb4f86\n> Author: Petr Baudis <pasky@pixie.suse.cz> Thu, 20 Jul 2006 11:37:31 -0400\n> \n>     * cg-commit:\n> \n>     Add signoff past the message if getting it from stdin\n> \n> What about this?\n\nThe thing you committed seems to work, so I am happy again. :) \n\n> diff --git a/cg-commit b/cg-commit\n> index 43e6c6c..beedb6f 100755\n> --- a/cg-commit\n> +++ b/cg-commit\n> @@ -402,10 +402,6 @@ if [ \"$msgfile\" ]; then\n>  \twritten=1\n>  fi\n>  \n> -# Always have at least one blank line, to ease the editing for\n> -# the poor people whose text editor has no 'O' command.\n> -[ \"$written\" ] || { tty -s && echo >>\"$LOGMSG\"; }\n> -\n>  add_signoff() {\n>  \tif [ \"$signoff\" ] && ! grep -q -i \"signed-off-by: $signoff\" $LOGMSG; then\n>  \t\tgrep -q -i sign-off-by $LOGMSG || echo\n\t\t\t   ^^^^^^^^^^^\n\nMy patch also fixed this to grep for \"signed-off-by\".\n\n-- \nJonas Fonseca\n"},{"id":"27576","messageId":"20060924200505.GY20017@pasky.or.cz","threadId":"5378","inReplyTo":"20060924183246.GA695@diku.dk","subject":"Re: [PATCH] cg-commit: fix signed off handling","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-09-24T20:05:05Z","receivedAt":"2006-09-24T20:05:05Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, Sep 24, 2006 at 08:32:46PM CEST, I got a letter\nwhere Jonas Fonseca <fonseca@diku.dk> said that...\n> Petr Baudis <pasky@suse.cz> wrote Sun, Sep 24, 2006:\n> > diff --git a/cg-commit b/cg-commit\n> > index 43e6c6c..beedb6f 100755\n> > --- a/cg-commit\n> > +++ b/cg-commit\n> > @@ -402,10 +402,6 @@ if [ \"$msgfile\" ]; then\n> >  \twritten=1\n> >  fi\n> >  \n> > -# Always have at least one blank line, to ease the editing for\n> > -# the poor people whose text editor has no 'O' command.\n> > -[ \"$written\" ] || { tty -s && echo >>\"$LOGMSG\"; }\n> > -\n> >  add_signoff() {\n> >  \tif [ \"$signoff\" ] && ! grep -q -i \"signed-off-by: $signoff\" $LOGMSG; then\n> >  \t\tgrep -q -i sign-off-by $LOGMSG || echo\n> \t\t\t   ^^^^^^^^^^^\n> \n> My patch also fixed this to grep for \"signed-off-by\".\n\nOh, thanks - fixed.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\nlK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n"}]}