[PATCH v2 2/2] dim: Make sure we push the branch before creating a tag

Daniel Vetter daniel at ffwll.ch
Thu Oct 10 13:53:03 UTC 2019


On Thu, Oct 10, 2019 at 03:50:47PM +0200, Maxime Ripard wrote:
> On Thu, Oct 10, 2019 at 03:03:55PM +0200, Daniel Vetter wrote:
> > On Thu, Oct 10, 2019 at 11:49:03AM +0200, Maxime Ripard wrote:
> > > 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.
> > >
> > > Signed-off-by: Maxime Ripard <mripard at kernel.org>
> > >
> > > ---
> > >
> > > Changes from v1:
> > >   - Switch to git_push
> > > ---
> > >  dim | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/dim b/dim
> > > index 0b1cd042345f..b581f246c5cc 100755
> > > --- a/dim
> > > +++ b/dim
> > > @@ -1962,6 +1962,7 @@ function tag_branch
> > >  	branch=$2
> > >  	remote=$(branch_to_remote $branch)
> > >
> > > +	git_push $remote $branch
> >
> > From a tool safety pov, not sure anymore this is the right thing to do.
> > You might end up push accidental garbage and fun stuff like that, since
> > this bypasses the usual checks dim push-branch does.
> 
> Ah, right.
> 
> > I think a check using git merge-base --is-ancestor and bailing out if your
> > local branch isn't contained in upstream (tagging something that's older
> > than latest upstream is legit imo) would be much better. Thoughts?
> 
> It could work. Another option would be to just tag the remote branch
> instead of the local one. Since the first thing we do is fetching
> everything (and since you just said that tagging something older than
> latest upstream is fine), it would allow to just ignore any local
> state of the branch we want to create a pull request for

If we just tag the remote branch then tagging older stuff isn't possible
anymore. Local branch you can roll back a few patches, remove tracking
branches not so much (well technically it's possible, if you fiddle around
in git internals).
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dim-tools mailing list