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

Jani Nikula jani.nikula at linux.intel.com
Fri May 4 14:13:23 UTC 2018


On Fri, 04 May 2018, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> 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.
>
> v2: Drop cat, use shell redirects to appeas shellcheck.
>
> Cc: Dave Airlie <airlied at gmail.com>
> Cc: Jani Nikula <jani.nikula at linux.intel.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 2faaab5a966a..1edcfea0caa5 100755
> --- a/dim
> +++ b/dim
> @@ -519,6 +519,15 @@ function rr_cache_dir
>  	fi
>  }
>  
> +function git_dir
> +{
> +	if [ -d $PWD/.git ] ; then
> +		echo $PWD/.git
> +	else
> +		cut -d ' ' -f 2 < $PWD/.git
> +	fi
> +}
> +
>  function pull_rerere_cache
>  {
>  	cd $DIM_PREFIX/drm-rerere/
> @@ -905,7 +914,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)
> @@ -935,6 +944,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

Technically you can move the assignment within the if block.

I don't know for sure that this thing works, but I'll take your word for
it.

Acked-by: Jani Nikula <jani.nikula at intel.com>


> +				echo "Link: https://patchwork.freedesktop.org/patch/msgid/$message_id" >> $merge_msg_file
> +			fi
> +
>  			return 1
>  		else
>  			git add -u

-- 
Jani Nikula, Intel Open Source Technology Center


More information about the dim-tools mailing list