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

Jani Nikula jani.nikula at linux.intel.com
Fri Feb 16 08:35:05 UTC 2018


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.

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