"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: got branch: support multiple -d options
To:
Stefan Sperling <stsp@stsp.name>
Cc:
Christian Weisgerber <naddy@mips.inka.de>, gameoftrees@openbsd.org
Date:
Wed, 18 May 2022 17:47:25 +0200

Download raw body.

Thread
Stefan Sperling <stsp@stsp.name> wrote:
> On Sun, May 15, 2022 at 11:22:28PM +0200, Christian Weisgerber wrote:
> > Stefan Sperling:
> > 
> > > If multiple -d options are passed to 'got branch' all arguments
> > > except the last one end up being ignored.
> > > 
> > > It seems more useful to delete all specified branches instead.
> > 
> > Hmmm.  Should this behave like "ref -d", where the -d flag doesn't take
> > an argument but switches to delete mode?
> 
> Or would it make sense to adjust 'got ref -d' to behave like
> 'got send -d' and 'got branch -d' (after this patch)?

FWIW I'm fine either the way but after hearing naddy I think I agree
with him.  Having -d as a "mode switch" allows to type something like

	$ got branch -d foo bar baz ...

which is handier than spamming -d ... -d ... -d ...  but admittedly i
don't remember how many times I wanted to delete more than one branch.

`got send -d' can't be tweaked to have -d as a "mode switch" because it
needs already a positional argument for the remote to use, but that's
probably fine as is.

> Perhaps 'got ref' could remain as it is. Since it is not intended to
> be used on a daily basis it doesn't need to provide much comfort.
> Unlike the other tools it requires absolute refnames as input (which
> start with "refs/"), and it does not have any safety checks. For instance,
> 'got branch -d' will refuse to delete a branch that is used by the current
> work tree. 'got ref -d' will delete the branch no matter what.