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

Kashyap Chamarthy kchamart at redhat.com
Tue Jan 23 16:24:17 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>

FWIW, as one of the drive-by people: 

    Reviewed-by: Kashyap Chamarthy <kchamart at redhat.com>

This change is simply making it easier to comply with DCO[*].

[*] https://developercertificate.org/

> ---
>  update | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> 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

-- 
/kashyap




More information about the libvir-list mailing list