Re: [PATCH v4 2/2] builtin/config.c: prefer `--type=bool` over `--bool`, etc.
- From
Jeff King <peff@peff.net>
- Date
- Apr 5, 2018, 22:40 UTC
- Message-ID
- <20180405224051.GF29117@sigill.intra.peff.net>
- In-Reply-To
- <CAPig+cSr744Y293qvgLG8jLHdNsGypkHU6QUQ-AcOyk=-JAbDw@mail.gmail.com>
On Thu, Apr 05, 2018 at 06:29:18PM -0400, Eric Sunshine wrote:
Show 17 quoted lines
> > +ensure that the variable(s) are of the given type and convert the value to the > > +canonical form. If no type specifier is passed, no checks or transformations are > > +performed on the value. > > @@ -160,30 +158,34 @@ See also <<FILES>>. > > --list:: > > List all variables set in config file, along with their values. > > > > ---bool:: > > - 'git config' will ensure that the output is "true" or "false" > > +--type <type>:: > > + 'git config' will ensure that any input output is valid under the given type > > + constraint(s), and will canonicalize outgoing values in `<type>`'s canonical > > + form. > > In response to my question[2] about whether the typesetting "[type]" > meant that it was optional, you responded[1] that it was not, thus > correctly changed the typesetting to "<type>". However...
Right, "--type" without a specifier means nothing (also, I missed this in my review, but "input output" in the quoted text?)
Show 12 quoted lines
> > diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh > > @@ -1622,4 +1623,21 @@ test_expect_success 'later legacy specifiers are given precedence' ' > > +test_expect_success '--no-type unsets type specifiers' ' > > + echo "10" > expect && > > + git config --type=bool --no-type core.number >actual && > > + test_cmp expect actual > > +' > > What does --no-type mean and why is it being tested? If this is an > explicitly supported user-facing option, should it be documented? If > it's not meant to be user-facing, then why are we enforcing its > presence and behavior via a test?
It would be the same as if no --type option had been given. The current documentation says:
If no type specifier is passed, no checks or transformations are performed on the value.
That's retained in the DESCRIPTION section, but it may be worth a mention of the "--no-type" behavior in the OPTIONS section, too. I dunno.
-Peff