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

Daniel Vetter daniel.vetter at ffwll.ch
Tue Feb 4 20:13:53 UTC 2020


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)
 
 	if [[ -z "$pull_branch" ]] ; then
 		echoerr "no pull request found"
-- 
2.24.1



More information about the dim-tools mailing list