[PATCH] dim: add From: tags for pull requests

Daniel Vetter daniel.vetter at ffwll.ch
Thu Aug 9 06:17:54 UTC 2018


On Tue, Aug 7, 2018 at 10:23 PM, Dave Airlie <airlied at gmail.com> wrote:
> On 8 August 2018 at 06:11, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
>> Requested by Dave Airlie, so that we automatically record the pull
>> request submitter somewhere. After quick irc chat we decided to put it
>> at the bottom, to avoid confusion with the From: git format-patch
>> inserts at the top for authors not matching the patch submitter.
>>
>> Requested-by: Dave Airlie <airlied at redhat.com>
>> Cc: Dave Airlie <airlied at redhat.com>
>> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
>
> Works for me.
>
> if there is more than one match to the grep will it pull that out?

It should add them all and you get to hand-edit the mess :-)

> Tested-by: Dave Airlie <airlied at redhat.com>

Can I haz an ack too for pushing?
-Daniel

>
>> ---
>>  dim | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/dim b/dim
>> index 5ca4646ff685..a1c194318b56 100755
>> --- a/dim
>> +++ b/dim
>> @@ -945,7 +945,7 @@ function dim_apply_branch
>>
>>  function dim_apply_pull
>>  {
>> -       local branch file message_id pull_branch rv merge_msg_file
>> +       local branch file message_id pull_branch rv merge_msg_file from_line
>>
>>         branch=${1:?$usage}
>>         file=$(mktemp)
>> @@ -956,6 +956,7 @@ function dim_apply_pull
>>         cat > $file
>>
>>         pull_branch=$(sed -ne '/[gG]it repository at:$/{n;n;p}' $file)
>> +       from_line=$(grep '^From:' $file)
>>
>>         if [[ -z "$pull_branch" ]] ; then
>>                 echoerr "no pull request found"
>> @@ -982,6 +983,7 @@ function dim_apply_pull
>>
>>                         merge_msg_file="$(git_dir)/MERGE_MSG"
>>                         if [ -n "$message_id" ]; then
>> +                               echo "$from_line" >> $merge_msg_file
>>                                 echo "Link: https://patchwork.freedesktop.org/patch/msgid/$message_id" >> $merge_msg_file
>>                         fi
>>
>> @@ -994,6 +996,7 @@ function dim_apply_pull
>>
>>         $DRY git commit --amend -s --no-edit
>>         if [ -n "$message_id" ]; then
>> +               $DRY dim_commit_add_tag "$from_line"
>>                 $DRY dim_commit_add_tag "Link: https://patchwork.freedesktop.org/patch/msgid/$message_id"
>>         fi
>>
>> --
>> 2.18.0
>>
>> _______________________________________________
>> 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