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

Daniel Vetter daniel.vetter at ffwll.ch
Tue Feb 4 20:13:00 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).

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 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dim b/dim
index 5cf2fdcc40be..e2ec21692d80 100755
--- a/dim
+++ b/dim
@@ -450,16 +450,19 @@ def print_msg(file):
 print_msg(open('$1', 'r'))
 EOF
 }
-
 # append all arguments as tags at the end of the commit message of HEAD
 function dim_commit_add_tag
 {
 	for arg; do
+		echo foo
+		echo sed "\$a${arg}"
 		# the first sed deletes all trailing blank lines at the end
+		echo bla
 		git log -1 --pretty=%B | \
 			sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | \
 			sed "\$a${arg}" | \
 			git commit --amend -F-
+		echo foo
 	done
 }
 
@@ -1125,7 +1128,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