From: Junio C Hamano Date: Fri, 22 Dec 2006 05:45:24 GMT Subject: Re: [PATCH] hooks/commit-msg: add example to add Signed-off-by line to message Message-ID: <7v64c47abv.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <200612210924.17357.andyparkins@gmail.com> Andy Parkins writes: > +# Uncomment the below to add a Signed-off-by line to the message. > +#SOB=$(git var GIT_AUTHOR_IDENT | \ > +# sed -n "s/^\(.*\) [0-9]\+ [-+][0-9]\+$/Signed-off-by: \1/p") > +#grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" I suspect this sed script is quite wrong. Did you test it? * quoting with dq means you are losing one level of backslash to the shell and sed is not seeing them. * one-or-more regexp '+' is typically not found in sed. Also if this is meant to also handle cases where somebody commits a patch received from an e-mail chain that multiple people signed off their own changes to the patch, your name may already appear earlier in the chain of existing Signed-off-by: lines to sign off an earlier edition of the patch, but what you are committing now would include your own changes you just made on top of what all these people did, and you would want to sign off that new change as well, I think. So checking the last instance of the existing signed-off-by line, ignoring earlier ones, may be more preferrable.