[PATCH] dim: Check whether committer is the author more thoroughly

Daniel Vetter daniel at ffwll.ch
Thu Apr 26 11:58:01 UTC 2018


On Thu, Apr 26, 2018 at 1:40 PM, Tvrtko Ursulin
<tvrtko.ursulin at linux.intel.com> wrote:
> On 26/04/2018 12:37, Tvrtko Ursulin wrote:
>>
>> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>>
>> For patch authors and committers with multiple email addresses, it is good
>> to check all 'From:' lines before deciding to add a Signed-off-by line.
>> This prevents adding duplicate S-o-B's in those cases.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>> ---
>>   dim | 21 +++++++++++++++++----
>>   1 file changed, 17 insertions(+), 4 deletions(-)
>>
>> diff --git a/dim b/dim
>> index 091dff8518ed..b587a4d1bccf 100755
>> --- a/dim
>> +++ b/dim
>> @@ -824,6 +824,22 @@ function dim_push
>>         dim_push_branch $(git_current_branch) "$@"
>>   }
>>   +function is_own_patch
>> +{
>> +       patch="$1"
>> +       committer_email="$2"
>> +
>> +       grep "From:" $patch | while read patch_from; do
>> +               [[ "$patch_from" == *"$committer_email"* ]] && exit 99
>> +       done
>> +
>> +       if [ $? -eq 99 ]; then
>> +               return 0
>> +       else
>> +               return 1
>> +       fi
>> +}
>> +
>>   function apply_patch #patch_file
>>   {
>>         local patch message_id committer_email patch_from sob rv
>> @@ -833,10 +849,7 @@ function apply_patch #patch_file
>>         message_id=$(message_get_id $patch)
>>         committer_email=$(git_committer_email)
>>   -     patch_from=$(grep "From:" "$patch" | head -1)
>> -       if [[ "$patch_from" != *"$committer_email"* ]] ; then
>> -               sob=-s
>> -       fi
>> +       is_own_patch "$patch" "$committer_email" || sob=-s
>>         git am --scissors -3 $sob "$@" $patch
>>
>
>
> Alternatively (and much simpler) we could grep for the actual S-o-B tag with
> committer's email? Or there was a reason we started with 'From:' grepping,
> can't remember.

Accident of history most likely, but in other places we do check the
git author vs. the git committer, and require that both put their sob
on the patch (e.g. in dim push).

While it's still an mbox From: == git author.

So this might work, but not sure you can push it without again upsetting dim.

I also find the multiple sob I occasionally put on my patches amusing :-)
-Daniel


> Regards,
>
> Tvrtko
>
> _______________________________________________
> dim-tools mailing list
> dim-tools at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dim-tools



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dim-tools mailing list