[PATCH 4/4] dim: store Link: in MERGE_MSG in apply-pull

Daniel Vetter daniel.vetter at ffwll.ch
Fri May 4 07:04:44 UTC 2018


This way there's no need for a dim apply-pull-continue, plain old git
commit is enough.

Aside: We might want to do the same trick for dim apply-branch, but
git am is a bit harder to script.

Cc: Dave Airlie <airlied at gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 dim | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/dim b/dim
index 26da35b55c32..8fde28cd55d3 100755
--- a/dim
+++ b/dim
@@ -525,6 +525,15 @@ function rr_cache_dir
 	fi
 }
 
+function git_dir
+{
+	if [ -d $PWD/.git ] ; then
+		echo $PWD/.git
+	else
+		cat $PWD/.git | cut -d ' ' -f 2
+	fi
+}
+
 function pull_rerere_cache
 {
 	cd $DIM_PREFIX/drm-rerere/
@@ -897,7 +906,7 @@ function dim_apply_branch
 
 function dim_apply_pull
 {
-	local branch file message_id pull_branch rv
+	local branch file message_id pull_branch rv merge_msg_file
 
 	branch=${1:?$usage}
 	file=$(mktemp)
@@ -929,6 +938,12 @@ function dim_apply_pull
 	if ! $DRY git pull $pull_branch ; then
 		if ! check_conflicts "$pull_branch" ; then
 			echoerr "Please resolve and then commit normally using git"
+
+			merge_msg_file="$(git_dir)/MERGE_MSG"
+			if [ -n "$message_id" ]; then
+				echo "Link: https://patchwork.freedesktop.org/patch/msgid/$message_id" >> $merge_msg_file
+			fi
+
 			return 1
 		else
 			git add -u
-- 
2.17.0



More information about the dim-tools mailing list