[libvirt] [PATCH hooks 1/1] Add check for Signed-off-by in commit messages

Ján Tomko jtomko at redhat.com
Mon Jan 22 12:22:01 UTC 2018


On Mon, Jan 22, 2018 at 12:05:19PM +0000, Daniel P. Berrange wrote:
>This extends the update hook so that it enforces a requirement to have a
>Signed-off-by line in every commit message. This can be optionally
>turned off in individual repos by setting the "hooks.allowmissingsob"
>git config variable.
>
>Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
>---
> update | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>

Given that signed-off-by lines are pointless for patches authored and
committed by the same person,

NACK unless the hooks.allowmissingsob will be set in the main
libvirt.git (I don't really care about other repos).

Jan

>diff --git a/update b/update
>index 6a8edcb..b7cfe7f 100755
>--- a/update
>+++ b/update
>@@ -248,7 +248,21 @@ if [ $check_diff = yes ]; then
> 	if [ "$allow_bad_whitespace" != "true" ]; then
> 		test "$oldrev" = $zero \
> 			&& exit 0
>-		exec git diff --check $oldrev $newrev --
>+		git diff --check $oldrev $newrev --
>+		test $? != 0 && exit 1
>+	fi
>+
>+	allow_missing_sob=$(git config --bool hooks.allowmissingsob)
>+	if [ "$allow_missing_sob" != "true" ]; then
>+		for rev in `git log --format=%h $oldrev..$newrev`
>+		do
>+			git show $rev | grep Signed-off-by >/dev/null 2>&1
>+			if test $? != 0
>+			then
>+				echo "*** Update hook: missing Signed-off-by tag in $rev" >&2
>+				exit 1
>+			fi
>+		done
> 	fi
> fi
>
>-- 
>2.14.3
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180122/d5c14c42/attachment-0001.sig>


More information about the libvir-list mailing list