[PATCH 3/5] dim: sanity checks for merges

Jani Nikula jani.nikula at linux.intel.com
Wed May 23 10:40:34 UTC 2018


On Wed, 23 May 2018, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> Just checks that merges aren't done without minimal thought.
>
> Cc: Jani Nikula <jani.nikula at linux.intel.com>
> Cc: Dave Airlie <airlied at gmail.com>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> ---
>  dim | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/dim b/dim
> index 2fa158231228..ff9e572726cb 100755
> --- a/dim
> +++ b/dim
> @@ -785,6 +785,24 @@ function checkpatch_commit_push
>  	return $rv
>  }
>  
> +function checkmerge_commit_push
> +{
> +	local sha1 managed_branch rv body_text
> +
> +	sha1=$1
> +	managed_branch=${2}
> +	rv=0
> +
> +	body_text="$(git show $sha1 -s --format="format:%b" | grep -v "^$" | grep -v "^\S*:")"
> +
> +	if [[ -z "$body_text" ]] ; then
> +		echoerr "$sha1 is lacking merge commit justification"
> +		rv=1
> +	fi
> +
> +	return $rv
> +}
> +
>  function checkpatch_commit_push_range
>  {
>  	local rv managed_branch
> @@ -797,6 +815,10 @@ function checkpatch_commit_push_range
>  		checkpatch_commit_push $sha1 $managed_branch || rv=1
>  	done
>  
> +	for sha1 in $(git rev-list "$@" --merges) ; do

Will that include merges within merges? If there's a backmerge of
drm-next which has a backmerge of upstream, there could be
anything... and *tons* of it.

BR,
Jani.

> +		checkmerge_commit_push $sha1 $managed_branch || rv=1
> +	done
> +
>  	if [ $rv == "1" ] ; then
>  		warn_or_fail "issues in commits detected"
>  	fi

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the dim-tools mailing list