[PATCH v3 2/2] dim: Make sure our local branch is pushed before creating a tag

Daniel Vetter daniel at ffwll.ch
Wed Nov 13 17:30:07 UTC 2019


On Wed, Nov 13, 2019 at 03:24:34PM +0100, Maxime Ripard wrote:
> From: Maxime Ripard <mripard at kernel.org>
> 
> The current dim code will create the tag using a local branch as an
> argument, but while we make sure to fetch the branch first in the callers,
> we don't actually make sure that any local change have been pushed.
> 
> Make sure it's the case before creating the tag by checking that all local
> commits have been pushed to the meaningful remote.
> 
> Signed-off-by: Maxime Ripard <mripard at kernel.org>

lgtm, I'll apply both and push once a trivial patch of mine has seen an
ack too. Too lazy to handle this with more than one branch :-)

Thanks for doing this.
-Daniel

> 
> ---
> 
> Changes from v2:
>   - Don't push the branch but make sure that it's been pushed instead
>     before creating the tag
> 
> Changes from v1:
>   - Switch to git_push
> ---
>  dim | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/dim b/dim
> index 0b1cd042345f..1c2da8034cd3 100755
> --- a/dim
> +++ b/dim
> @@ -1962,6 +1962,11 @@ function tag_branch
>  	branch=$2
>  	remote=$(branch_to_remote $branch)
>  
> +	if ! git merge-base --is-ancestor $branch $remote/$branch ; then
> +		echoerr "Branch contains local commits. Aborting."
> +		exit 1
> +	fi
> +
>  	tag_summary $branch | $DRY git tag -F- $tag "$branch@{upstream}"
>  	$DRY git tag -a $DIM_GPG_KEYID -f $tag
>  	git_push $remote $tag
> -- 
> 2.23.0
> 
> _______________________________________________
> dim-tools mailing list
> dim-tools at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dim-tools

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dim-tools mailing list