{"thread":{"id":"2711","subject":"[PATCH] cg-commit: append sign off line when passed -s or --signoff","startedAt":"2005-11-29T23:58:51Z","lastAt":"2005-11-29T23:58:51Z","messageCount":1,"participants":["Jonas Fonseca"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"12961","messageId":"20051129235851.GB5365@diku.dk","threadId":"2711","inReplyTo":null,"subject":"[PATCH] cg-commit: append sign off line when passed -s or --signoff","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2005-11-29T23:58:51Z","receivedAt":"2005-11-29T23:58:51Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"No sign off line is appended if it already is signed off. By default the\nidentity reported by 'git-var GIT_AUTHOR_IDENT' is used for signing off.\nOptionally, specify the name and email to sign off with by doing:\n\n\tcg-commit --signoff='Author Name <user@example.com>\n\nIf the commit message specified on the command line already contains\nsigned off lines no empty line is inserted between the message and the\nsign off line.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n\n---\ncommit dd872816a04f6462686e282b00d3e1523e3ecf4c\ntree a8487566085727636a5782e2edb270190b9f3916\nparent c0a9b8feb79d72f7c02f37392da840dbad446dbd\nauthor Jonas Fonseca <fonseca@diku.dk> Mon, 28 Nov 2005 04:42:05 +0100\ncommitter Jonas Fonseca <fonseca@antimatter.localdomain> Mon, 28 Nov 2005 04:42:05 +0100\n\n TODO      |    2 --\n cg-commit |   17 ++++++++++++++++-\n 2 files changed, 16 insertions(+), 3 deletions(-)\n\ndiff --git a/TODO b/TODO\nindex 5193d08..777c728 100644\n--- a/TODO\n+++ b/TODO\n@@ -79,8 +79,6 @@ cg-*patch should be pre-1.0.)\n \t\t  whitespace errors and stuff; hooks are good for this too,\n \t\t  but I think it's good to have internal support for the\n \t\t  basic stuff.\n-\t\t* -s,--signoff to automatically append a signoff line of\n-\t\t  yours to the patch.\n \t-- post 1.0 --\n \t* Patch-altering cg-commit\n \t\tYou can already alter the list of files to be committed,\ndiff --git a/cg-commit b/cg-commit\nindex d084c24..9f8d5d5 100755\n--- a/cg-commit\n+++ b/cg-commit\n@@ -58,6 +58,11 @@\n #\tBe quiet in case there's \"nothing to commit\", and silently exit\n #\treturning success. In a sense, this is the opposite to '-f'.\n #\n+# -s, --signoff:: Automatically append a sign off line\n+#\tAdd Signed-off-by line at the end of the commit message.\n+#\tOptionally, specify the exact name and email to sign off with by\n+#\tpassing: `--signoff=\"Author Name <user@example.com>\"`.\n+#\n # FILES\n # -----\n # $GIT_DIR/author::\n@@ -119,7 +124,7 @@\n # EDITOR::\n #\tThe editor used for entering revision log information.\n \n-USAGE=\"cg-commit [-m MESSAGE]... [-C] [-e | -E] [-c COMMIT_ID] [FILE]... [< MESSAGE]\"\n+USAGE=\"cg-commit [-m MESSAGE]... [-C] [-e | -E] [-s | --signoff] [-c COMMIT_ID] [FILE]... [< MESSAGE]\"\n \n . ${COGITO_LIB}cg-Xlib || exit 1\n \n@@ -148,6 +153,7 @@ ignorecache=\n infoonly=\n commitalways=\n missingok=\n+signoff=\n copy_commit=\n msgs=()\n quiet=\n@@ -166,6 +172,10 @@ while optparse; do\n \t\tforce=1\n \telif optparse -q; then\n \t\tquiet=1\n+\telif optparse -s || optparse --signoff; then\n+\t\t[ \"$signoff\" ] || signoff=\"$(git-var GIT_AUTHOR_IDENT | sed 's/> .*/>/')\"\n+\telif optparse --signoff=; then\n+\t\tsignoff=\"$OPTARG\"\n \telif optparse -m=; then\n \t\tmsgs[${#msgs[@]}]=\"$OPTARG\"\n \telif optparse -c=; then\n@@ -292,6 +302,11 @@ fi >> $LOGMSG\n # the poor people whose text editor has no 'O' command.\n [ \"$written\" ] || echo >>$LOGMSG\n \n+if [ \"$signoff\" ] && ! grep -q -i \"signed-off-by: $signoff\" $LOGMSG; then\n+\tgrep -q -i sign-off-by $LOGMSG || echo\n+\techo \"Signed-off-by: $signoff\"\n+fi >> $LOGMSG\n+\n if [ -e \"$_git/commit-template\" ]; then\n \tcat $_git/commit-template >>$LOGMSG\n else\n\n-- \nJonas Fonseca\n"}]}