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

Daniel Vetter daniel at ffwll.ch
Wed May 23 12:25:59 UTC 2018


On Wed, May 23, 2018 at 01:40:34PM +0300, Jani Nikula wrote:
> 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.

Yes and no. For pushing we include --committer=$self in the argument list,
not just the sha1 rangeish (Aside: that's why we need those last, since
there's a variable amount of them). When pulling, we check the entire
pull. Same applies for checking normal commits, which I think is the right
thing to do for these sanity checks.

More concrete: When Dave pushes, dim will only complain about his own
merges. But when he pulls, dim will complain e.g. both about dinq and
about gvt merges.
-Daniel

> 
> 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

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dim-tools mailing list