Re: [PATCH] hooks/commit-msg: add example to add Signed-off-by line to message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andy Parkins <andyparkins@xxxxxxxxx> 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.






-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]