Re: [PATCH v2] commit-tree: utilize parse-options api

2019-03-01 Thread Brandon Richardson
Hi Eric, On Fri, Mar 1, 2019 at 3:53 PM Eric Sunshine wrote: > Note, in particular how Peff used !(arg) rather than (!arg) in your > patch. This distinction is subtle but important enough to warrant > being called out. The reason that Peff did it this way (the _correct_ > way) is that, as a macro

Re: [PATCH v2] commit-tree: utilize parse-options api

2019-03-01 Thread Brandon Richardson
On Fri, Mar 1, 2019 at 2:09 PM Jeff King wrote: > I think you want an "OR". Or even separate conditions, since really this > is just implying OPT_NEG(). In fact, you could implement and explain it > like this: > > diff --git a/parse-options.h b/parse-options.h > index 14fe32428e..d46f89305c 100644

Re: [PATCH v2] commit-tree: utilize parse-options api

2019-03-01 Thread Eric Sunshine
On Fri, Mar 1, 2019 at 2:10 PM Jeff King wrote: > On Fri, Mar 01, 2019 at 01:13:04PM -0400, Brandon Richardson wrote: > > + if((!unset) && (!arg)) \ > > + BUG("option callback does not expect negation and requires an > > argument"); \ Peff didn't highlight this, but compare your

Re: [PATCH v2] commit-tree: utilize parse-options api

2019-03-01 Thread Jeff King
On Fri, Mar 01, 2019 at 01:13:04PM -0400, Brandon Richardson wrote: > +/* > + * Use this assertion for callbacks that expect to be called with NONEG, > + * and require an argument be supplied. > + */ > +#define BUG_ON_OPT_NEG_NOARG(unset, arg) do { \ I think this general concept is fine. It's a v

[PATCH v2] commit-tree: utilize parse-options api

2019-03-01 Thread Brandon Richardson
Rather than parse options manually, which is both difficult to read and error prone, parse options supplied to commit-tree using the parse-options api. It was discovered that the --no-gpg-sign option was documented but not implemented in commit 70ddbd7767 (commit-tree: add missing --gpg-sign flag,