[PATCH] dim: Handle multiple From: lines in pull request

Rodrigo Vivi rodrigo.vivi at intel.com
Tue Feb 4 20:20:47 UTC 2020


On Tue, Feb 04, 2020 at 09:13:53PM +0100, Daniel Vetter wrote:
> dim blew up on the pull from Thomas:
> 
> https://patchwork.freedesktop.org/patch/348981/
> 
> Thomas helpfully added an in-body From: line, similar to how git
> format-patch does. But our dim parsing choked on the double From: line
> that resulted in.
> 
> Assume that if there's a 2nd From: line it's there for a good reason
> and pick that one (like git apply-mbox).
> 
> v2: Ditch the debug stuff ... silly me.
> 
> Cc: "Thomas Hellström (VMware)" <thomas_os at shipmail.org>
> Cc: Dave Airlie <airlied at gmail.com>
> Reported-by: Dave Airlie <airlied at gmail.com>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> ---
>  dim | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/dim b/dim
> index 5cf2fdcc40be..1e61fe2f9ed9 100755
> --- a/dim
> +++ b/dim
> @@ -1125,7 +1125,7 @@ function dim_apply_pull
>  		sed -ne '/^[^>].*[gG]it repository at:$/,/for you to fetch/{p}' |
>  		sed -ne '3,$p' | sed -ne '0,/^$/p' | tr '\n' ' ')
>  
> -	from_line=$(grep '^From:' $file)
> +	from_line=$(grep '^From:' $file | tail -n 1)

Wouldn't be better (safer) to grab the first From then the last one?

>  
>  	if [[ -z "$pull_branch" ]] ; then
>  		echoerr "no pull request found"
> -- 
> 2.24.1
> 
> _______________________________________________
> dim-tools mailing list
> dim-tools at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dim-tools


More information about the dim-tools mailing list