[PATCH 1/2] dim: Workaround Outlook + Patchwork mess.

Rodrigo Vivi rodrigo.vivi at intel.com
Fri Feb 16 18:24:49 UTC 2018


On Fri, Feb 16, 2018 at 10:35:05AM +0200, Jani Nikula wrote:
> On Thu, 15 Feb 2018, Rodrigo Vivi <rodrigo.vivi at intel.com> wrote:
> > Patchwork has a own identity that doesn't respect the author configuration.
> > It automatically changes the author to whatever it was last seen on
> > the public mailing list.
> 
> I take it you see this problem when applying patches from patchwork? At
> least I don't see this when I apply patches directly from my mailbox.

Yes, I figured that maybe I'm the only one using the patchwork with dim
instead of using from email client.

The advantages that I like using from patchwork instead of email is:
- Automatically adding Reviewed-by, Acked-by and other tags when explicitly giving.
- pwclient search result is easier to see what is the latest version of the patch
  avoiding some possible confusion from my side.

So in my use case I search with pwclient and I have a hook on my .dimrc
that giving a patchwork id I download the patch with curl and apply.

I figured that I would add this hack on my side as I have my own
hooks to apply from patchwork. But I decided to send this for discussion
before so if someone see any value on this we could add this inside dim.

(btw, Jani could you please share with me any .emacs script that you
might have there? I'm already using the notmuch there and have some hooks
already to accept the gvt pull requests from there. Maybe I consider
fully changing to that approach.)

> 
> Wouldn't patchwork be the right place to fix this?
> 
> Cc: Arek
> 
> BR,
> Jani.
> 
> >
> > In case the response came from an outlook server the author identity
> > inside patchwork will get changed to Last, First.
> >
> > We have authors that respond emails to public mailing list using
> > Intel emails. Even non outlook users can end up having this trouble
> > because the Evolution can be setup with EWS, for instance.
> >
> > Since we could never fix patchwork for real to respect users
> > choice we can workaround it here when applying the patch.
> >
> > It is really unlikely that users will have author and signed-off
> > configured one with "First Last" and other "Last, Name". So if
> > we identify this case when applying the patch let's be smart
> > and fix it up.
> >
> > I have merged many patches recently where this happened. When
> > asking the authors the response was always the same, please
> > respect the sign-off and use "Name Last".
> >
> > Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
> > Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> > Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> > ---
> >  dim | 30 ++++++++++++++++++++++++++++++
> >  1 file changed, 30 insertions(+)
> >
> > diff --git a/dim b/dim
> > index ed26033f5aba..4493b48b1494 100755
> > --- a/dim
> > +++ b/dim
> > @@ -813,6 +813,32 @@ function dim_push
> >  	dim_push_branch $(git_current_branch) "$@"
> >  }
> >  
> > +function fixup_outlook_author
> > +{
> > +	sha1=$1
> > +
> > +	# use real names for people with many different email addresses
> > +	author=$(git show -s $sha1 --format="format:%an")
> > +	# outlook mangles mails into "Last, First"
> > +	author_outlook=$(git show -s $sha1 --format="format:%an" | sed -e 's/\([^ ]*\) \(.*\)/\2 \1/;s/,//')
> > +	committer=$(git show -s $sha1 --format="format:%cn")
> > +
> > +	# check for author sign-off
> > +	if ! git show -s $sha1 | grep -qi "S.*-by:.$author" ; then
> > +		# outlook mangles mails into "Last, First"
> > +		author_outlook=$(git show -s $sha1 --format="format:%an" | sed -e 's/\([^ ]*\) \(.*\)/\2 \1/;s/,//')
> > +		if git show -s $sha1 | grep -qi "S.*-by:.$author_outlook" ; then
> > +			echo -e "It seems outlook and patchwork messed up author, fixing it up..."
> > +			author_email=$(git show -s $sha1 --format="format:%ae")
> > +			git commit --amend --no-edit --author="$author_outlook <$author_email>"
> > +		else
> > +			echo -e "$sha1 is lacking author of sign-off"
> > +			rv=1
> > +		fi
> > +	fi
> > +	return $rv
> > +}
> > +
> >  function apply_patch #patch_file
> >  {
> >  	local patch message_id committer_email patch_from sob rv
> > @@ -843,6 +869,10 @@ function apply_patch #patch_file
> >  		rv=1
> >  	fi
> >  
> > +	if ! fixup_outlook_author HEAD; then
> > +		rv=1
> > +	fi
> > +
> >  	eval $DRY $DIM_POST_APPLY_ACTION
> >  	return $rv
> >  }
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center


More information about the dim-tools mailing list