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

Daniel Vetter daniel.vetter at ffwll.ch
Tue Aug 7 20:11:09 UTC 2018


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>
---
 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



More information about the dim-tools mailing list