From: Junio C Hamano <gitster@pobox.com>
To: Andreas Heiduk <asheiduk@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] doc: clarify "config --bool" behaviour with empty values
Date: Mon, 14 Aug 2017 10:53:50 -0700 [thread overview]
Message-ID: <xmqq60dqvxw1.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170813094816.7754-1-asheiduk@gmail.com> (Andreas Heiduk's message of "Sun, 13 Aug 2017 11:48:16 +0200")
Andreas Heiduk <asheiduk@gmail.com> writes:
> `git config --bool xxx.yyy` returns `true` for `[xxx]yyy` but
> `false` for `[xxx]yyy=` or `[xxx]yyy=""`. This is tested in
> t1300-repo-config.sh since 09bc098c2.
>
> Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
> ---
> Documentation/config.txt | 3 ++-
> Documentation/git.txt | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index d5c9c4cab..d3261006b 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -221,7 +221,8 @@ boolean::
> is taken as true.
>
> false;; Boolean false can be spelled as `no`, `off`,
> - `false`, or `0`.
> + `false`, `0`, no value (but still with `=`) or the
> + empty string.
Thanks for noticing that it was a problem not spelling out that an
empty string means false. We do need to spell it out.
However, I think this "no value (but still with '=')" is making it
more confusing than necessary for two reasons.
(1) The notation
[section] var =
is a perfectly valid way to spell an empty string, and is *not*
a way to say "section.var has no value".
(2) In fact there is no way to say "section.var has no value", which
is an often lamented inconvenience, because sometimes people may
have their own setting in ~/.gitconfig and want to override it
in the repository specific .git/config but do the overriding not
with a specific value but by saying "pretend as if there were no
setting in lower precedence configuration files like
~/.gitconfig". If we ever fix this and introduce some syntax to
mean "the variable has no value", it will become necessary to
update the above description, but I am sure nobody will remember
it.
I notice that in this Values section (where the boolean:: is the
first entry) there is no mention on how to spell a string value.
Perhaps something like this?
diff --git a/Documentation/config.txt b/Documentation/config.txt
index d5c9c4cab6..7580088bec 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -210,6 +210,14 @@ Values of many variables are treated as a simple string, but there
are variables that take values of specific types and there are rules
as to how to spell them.
+string::
+
+ A variable can take a string value, which can be quoted with
+ double quotes and backslashes as outlined in the Syntax
+ section above. Note that it is sufficient to say 'name ='
+ without anything after the equal sign to spell an empty
+ string.
+
boolean::
When a variable is said to take a boolean value, many
@@ -221,7 +229,7 @@ boolean::
is taken as true.
false;; Boolean false can be spelled as `no`, `off`,
- `false`, or `0`.
+ `false`, or `0`. An empty string can also be used.
+
When converting value to the canonical form using `--bool` type
specifier; 'git config' will ensure that the output is "true" or
next prev parent reply other threads:[~2017-08-14 17:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-13 9:48 [PATCH] doc: clarify "config --bool" behaviour with empty values Andreas Heiduk
2017-08-14 17:53 ` Junio C Hamano [this message]
2017-08-14 22:07 ` Andreas Heiduk
2017-08-14 22:12 ` [PATCH v2] " Andreas Heiduk
2017-08-14 22:24 ` Junio C Hamano
2017-08-14 22:21 ` [PATCH] " Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq60dqvxw1.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=asheiduk@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.