From: Jonas Fonseca <fonseca@diku.dk>
To: Petr Baudis <pasky@ucw.cz>
Cc: git@vger.kernel.org
Subject: [PATCH] cg-commit: append sign off line when passed -s or --signoff
Date: Wed, 30 Nov 2005 00:58:51 +0100 [thread overview]
Message-ID: <20051129235851.GB5365@diku.dk> (raw)
No sign off line is appended if it already is signed off. By default the
identity reported by 'git-var GIT_AUTHOR_IDENT' is used for signing off.
Optionally, specify the name and email to sign off with by doing:
cg-commit --signoff='Author Name <user@example.com>
If the commit message specified on the command line already contains
signed off lines no empty line is inserted between the message and the
sign off line.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
commit dd872816a04f6462686e282b00d3e1523e3ecf4c
tree a8487566085727636a5782e2edb270190b9f3916
parent c0a9b8feb79d72f7c02f37392da840dbad446dbd
author Jonas Fonseca <fonseca@diku.dk> Mon, 28 Nov 2005 04:42:05 +0100
committer Jonas Fonseca <fonseca@antimatter.localdomain> Mon, 28 Nov 2005 04:42:05 +0100
TODO | 2 --
cg-commit | 17 ++++++++++++++++-
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/TODO b/TODO
index 5193d08..777c728 100644
--- a/TODO
+++ b/TODO
@@ -79,8 +79,6 @@ cg-*patch should be pre-1.0.)
whitespace errors and stuff; hooks are good for this too,
but I think it's good to have internal support for the
basic stuff.
- * -s,--signoff to automatically append a signoff line of
- yours to the patch.
-- post 1.0 --
* Patch-altering cg-commit
You can already alter the list of files to be committed,
diff --git a/cg-commit b/cg-commit
index d084c24..9f8d5d5 100755
--- a/cg-commit
+++ b/cg-commit
@@ -58,6 +58,11 @@
# Be quiet in case there's "nothing to commit", and silently exit
# returning success. In a sense, this is the opposite to '-f'.
#
+# -s, --signoff:: Automatically append a sign off line
+# Add Signed-off-by line at the end of the commit message.
+# Optionally, specify the exact name and email to sign off with by
+# passing: `--signoff="Author Name <user@example.com>"`.
+#
# FILES
# -----
# $GIT_DIR/author::
@@ -119,7 +124,7 @@
# EDITOR::
# The editor used for entering revision log information.
-USAGE="cg-commit [-m MESSAGE]... [-C] [-e | -E] [-c COMMIT_ID] [FILE]... [< MESSAGE]"
+USAGE="cg-commit [-m MESSAGE]... [-C] [-e | -E] [-s | --signoff] [-c COMMIT_ID] [FILE]... [< MESSAGE]"
. ${COGITO_LIB}cg-Xlib || exit 1
@@ -148,6 +153,7 @@ ignorecache=
infoonly=
commitalways=
missingok=
+signoff=
copy_commit=
msgs=()
quiet=
@@ -166,6 +172,10 @@ while optparse; do
force=1
elif optparse -q; then
quiet=1
+ elif optparse -s || optparse --signoff; then
+ [ "$signoff" ] || signoff="$(git-var GIT_AUTHOR_IDENT | sed 's/> .*/>/')"
+ elif optparse --signoff=; then
+ signoff="$OPTARG"
elif optparse -m=; then
msgs[${#msgs[@]}]="$OPTARG"
elif optparse -c=; then
@@ -292,6 +302,11 @@ fi >> $LOGMSG
# the poor people whose text editor has no 'O' command.
[ "$written" ] || echo >>$LOGMSG
+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 [ -e "$_git/commit-template" ]; then
cat $_git/commit-template >>$LOGMSG
else
--
Jonas Fonseca
reply other threads:[~2005-11-29 23:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20051129235851.GB5365@diku.dk \
--to=fonseca@diku.dk \
--cc=git@vger.kernel.org \
--cc=pasky@ucw.cz \
/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).