[PATCH] dim: Ensure a branch doesn't exist before creating it

Daniel Vetter daniel at ffwll.ch
Wed Jan 31 18:12:13 UTC 2018


On Wed, Jan 31, 2018 at 11:24:07AM -0500, Sean Paul wrote:
> Check the remote for the branch before creating it. Seems like this is
> a noop if it does exist, aside from creating duplicate entries in the
> integration config.
> 
> Signed-off-by: Sean Paul <seanpaul at chromium.org>

Thanks for fixing this.

Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

I'll also push (note to self: really need to get maintaner-tools out of
drm-intel.git).
-Daniel

> ---
>  dim | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/dim b/dim
> index 73936cea4869..3639ada1854b 100755
> --- a/dim
> +++ b/dim
> @@ -1215,6 +1215,10 @@ function dim_create_branch
>  	fi
>  
>  	remote=$(repo_to_remote $repo)
> +	if [[ $(git branch -r | grep "$remote/$branch") ]]; then
> +		echoerr "$branch already exists on $remote"
> +		return 1
> +	fi
>  
>  	$DRY git branch $branch $start
>  	git push $DRY_RUN $remote +$branch --set-upstream
> -- 
> 2.16.0.rc1.238.g530d649a79-goog
> 
> _______________________________________________
> 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