Re: [PATCH] doc: clarify "config --bool" behaviour with empty values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andreas Heiduk <asheiduk@xxxxxxxxx> 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@xxxxxxxxx>
> ---
>  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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux