{"thread":{"id":"46581","subject":"[PATCH] doc: clarify \"config --bool\" behaviour with empty values","startedAt":"2017-08-13T09:48:37Z","lastAt":"2017-08-14T22:24:23Z","messageCount":6,"participants":["Andreas Heiduk","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"326239","messageId":"20170813094816.7754-1-asheiduk@gmail.com","threadId":"46581","inReplyTo":null,"subject":"[PATCH] doc: clarify \"config --bool\" behaviour with empty values","fromName":"Andreas Heiduk","fromEmail":"asheiduk@gmail.com","sentAt":"2017-08-13T09:48:16Z","receivedAt":"2017-08-13T09:48:37Z","isPatch":true,"sender":{"key":"asheiduk@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9371344?v=4"},"body":"`git config --bool xxx.yyy` returns `true` for `[xxx]yyy` but\n`false` for `[xxx]yyy=` or `[xxx]yyy=\"\"`.  This is tested in\nt1300-repo-config.sh since 09bc098c2.\n\nSigned-off-by: Andreas Heiduk <asheiduk@gmail.com>\n---\n Documentation/config.txt | 3 ++-\n Documentation/git.txt    | 3 ++-\n 2 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex d5c9c4cab..d3261006b 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -221,7 +221,8 @@ boolean::\n \t\tis taken as true.\n \n        false;; Boolean false can be spelled as `no`, `off`,\n-\t\t`false`, or `0`.\n+\t\t`false`, `0`, no value (but still with `=`) or the\n+\t\tempty string.\n +\n When converting value to the canonical form using `--bool` type\n specifier; 'git config' will ensure that the output is \"true\" or\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 7dd5e0328..6e3a6767e 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -75,7 +75,8 @@ example the following invocations are equivalent:\n Note that omitting the `=` in `git -c foo.bar ...` is allowed and sets\n `foo.bar` to the boolean true value (just like `[foo]bar` would in a\n config file). Including the equals but with an empty value (like `git -c\n-foo.bar= ...`) sets `foo.bar` to the empty string.\n+foo.bar= ...`) sets `foo.bar` to the empty string which ` git config\n+--bool` will convert to `false`.\n \n --exec-path[=<path>]::\n \tPath to wherever your core Git programs are installed.\n-- \n2.13.3\n\n"},{"id":"326287","messageId":"xmqq60dqvxw1.fsf@gitster.mtv.corp.google.com","threadId":"46581","inReplyTo":"20170813094816.7754-1-asheiduk@gmail.com","subject":"Re: [PATCH] doc: clarify \"config --bool\" behaviour with empty values","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-08-14T17:53:50Z","receivedAt":"2017-08-14T17:54:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Heiduk <asheiduk@gmail.com> writes:\n\n> `git config --bool xxx.yyy` returns `true` for `[xxx]yyy` but\n> `false` for `[xxx]yyy=` or `[xxx]yyy=\"\"`.  This is tested in\n> t1300-repo-config.sh since 09bc098c2.\n>\n> Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>\n> ---\n>  Documentation/config.txt | 3 ++-\n>  Documentation/git.txt    | 3 ++-\n>  2 files changed, 4 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index d5c9c4cab..d3261006b 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -221,7 +221,8 @@ boolean::\n>  \t\tis taken as true.\n>  \n>         false;; Boolean false can be spelled as `no`, `off`,\n> -\t\t`false`, or `0`.\n> +\t\t`false`, `0`, no value (but still with `=`) or the\n> +\t\tempty string.\n\nThanks for noticing that it was a problem not spelling out that an\nempty string means false.  We do need to spell it out.\n\nHowever, I think this \"no value (but still with '=')\" is making it\nmore confusing than necessary for two reasons.\n\n(1) The notation\n\n\t[section] var =\n\n    is a perfectly valid way to spell an empty string, and is *not*\n    a way to say \"section.var has no value\".\n\n(2) In fact there is no way to say \"section.var has no value\", which\n    is an often lamented inconvenience, because sometimes people may\n    have their own setting in ~/.gitconfig and want to override it\n    in the repository specific .git/config but do the overriding not\n    with a specific value but by saying \"pretend as if there were no\n    setting in lower precedence configuration files like\n    ~/.gitconfig\".  If we ever fix this and introduce some syntax to\n    mean \"the variable has no value\", it will become necessary to\n    update the above description, but I am sure nobody will remember\n    it.\n\nI notice that in this Values section (where the boolean:: is the\nfirst entry) there is no mention on how to spell a string value.\n\nPerhaps something like this?\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex d5c9c4cab6..7580088bec 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -210,6 +210,14 @@ Values of many variables are treated as a simple string, but there\n are variables that take values of specific types and there are rules\n as to how to spell them.\n \n+string::\n+\n+\tA variable can take a string value, which can be quoted with\n+\tdouble quotes and backslashes as outlined in the Syntax\n+\tsection above.  Note that it is sufficient to say 'name ='\n+\twithout anything after the equal sign to spell an empty\n+\tstring.\n+\n boolean::\n \n        When a variable is said to take a boolean value, many\n@@ -221,7 +229,7 @@ boolean::\n \t\tis taken as true.\n \n        false;; Boolean false can be spelled as `no`, `off`,\n-\t\t`false`, or `0`.\n+\t\t`false`, or `0`.  An empty string can also be used.\n +\n When converting value to the canonical form using `--bool` type\n specifier; 'git config' will ensure that the output is \"true\" or\n"},{"id":"326325","messageId":"914098af-00a9-fbc8-cdfe-a65918b2951b@gmail.com","threadId":"46581","inReplyTo":"xmqq60dqvxw1.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] doc: clarify \"config --bool\" behaviour with empty values","fromName":"Andreas Heiduk","fromEmail":"asheiduk@gmail.com","sentAt":"2017-08-14T22:07:26Z","receivedAt":"2017-08-14T22:07:37Z","isPatch":true,"sender":{"key":"asheiduk@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9371344?v=4"},"body":"Am 14.08.2017 um 19:53 schrieb Junio C Hamano:\n> Andreas Heiduk <asheiduk@gmail.com> writes:\n> \n>> `git config --bool xxx.yyy` returns `true` for `[xxx]yyy` but\n>> `false` for `[xxx]yyy=` or `[xxx]yyy=\"\"`.  This is tested in\n>> t1300-repo-config.sh since 09bc098c2.\n>>\n>> Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>\n>> ---\n>>  Documentation/config.txt | 3 ++-\n>>  Documentation/git.txt    | 3 ++-\n>>  2 files changed, 4 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/Documentation/config.txt b/Documentation/config.txt\n>> index d5c9c4cab..d3261006b 100644\n>> --- a/Documentation/config.txt\n>> +++ b/Documentation/config.txt\n>> @@ -221,7 +221,8 @@ boolean::\n>>  \t\tis taken as true.\n>>  \n>>         false;; Boolean false can be spelled as `no`, `off`,\n>> -\t\t`false`, or `0`.\n>> +\t\t`false`, `0`, no value (but still with `=`) or the\n>> +\t\tempty string.\n> \n[...]\n \n> However, I think this \"no value (but still with '=')\" is making it\n> more confusing than necessary for two reasons.\n[...]\n \n> I notice that in this Values section (where the boolean:: is the\n> first entry) there is no mention on how to spell a string value.\n\nI assumed this is due to the pretext of the definition list:\n\n\tValues of many variables are treated as a simple string, but there\n\tare variables that take values of specific types and there are rules\n\tas to how to spell them.\n\nAfter that I would NOT expect string values to be \"specific\". Also: If string \nvalues are explained here in the \"Values\" section, the line-breaking and escape \nsequences syntax should be here too.\n\nSo my (minimal) suggestion is:\n\n       false;; Boolean false literals are `no`, `off`,\n                `false`, `0` and the empty string.\n\nI'll adapt `true` in the same style and resend a patch.\n"},{"id":"326326","messageId":"20170814221218.18874-1-asheiduk@gmail.com","threadId":"46581","inReplyTo":"914098af-00a9-fbc8-cdfe-a65918b2951b@gmail.com","subject":"[PATCH v2] doc: clarify \"config --bool\" behaviour with empty values","fromName":"Andreas Heiduk","fromEmail":"asheiduk@gmail.com","sentAt":"2017-08-14T22:12:18Z","receivedAt":"2017-08-14T22:13:07Z","isPatch":true,"sender":{"key":"asheiduk@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9371344?v=4"},"body":"`git config --bool xxx.yyy` returns `true` for `[xxx]yyy` but\n`false` for `[xxx]yyy=` or `[xxx]yyy=\"\"`.  This is tested in\nt1300-repo-config.sh since 09bc098c2.\n\nSigned-off-by: Andreas Heiduk <asheiduk@gmail.com>\n---\n Documentation/config.txt | 10 +++++-----\n Documentation/git.txt    |  3 ++-\n 2 files changed, 7 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex d5c9c4cab..478b9431e 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -216,15 +216,15 @@ boolean::\n        synonyms are accepted for 'true' and 'false'; these are all\n        case-insensitive.\n \n-       true;; Boolean true can be spelled as `yes`, `on`, `true`,\n-\t\tor `1`.  Also, a variable defined without `= <value>`\n+\ttrue;; Boolean true literals are `yes`, `on`, `true`,\n+\t\tand `1`.  Also, a variable defined without `= <value>`\n \t\tis taken as true.\n \n-       false;; Boolean false can be spelled as `no`, `off`,\n-\t\t`false`, or `0`.\n+\tfalse;; Boolean false literals are `no`, `off`, `false`,\n+\t\t`0` and the empty string.\n +\n When converting value to the canonical form using `--bool` type\n-specifier; 'git config' will ensure that the output is \"true\" or\n+specifier, 'git config' will ensure that the output is \"true\" or\n \"false\" (spelled in lowercase).\n \n integer::\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 7dd5e0328..6e3a6767e 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -75,7 +75,8 @@ example the following invocations are equivalent:\n Note that omitting the `=` in `git -c foo.bar ...` is allowed and sets\n `foo.bar` to the boolean true value (just like `[foo]bar` would in a\n config file). Including the equals but with an empty value (like `git -c\n-foo.bar= ...`) sets `foo.bar` to the empty string.\n+foo.bar= ...`) sets `foo.bar` to the empty string which ` git config\n+--bool` will convert to `false`.\n \n --exec-path[=<path>]::\n \tPath to wherever your core Git programs are installed.\n-- \n2.14.1\n\n"},{"id":"326328","messageId":"xmqqlgmlu6y7.fsf@gitster.mtv.corp.google.com","threadId":"46581","inReplyTo":"914098af-00a9-fbc8-cdfe-a65918b2951b@gmail.com","subject":"Re: [PATCH] doc: clarify \"config --bool\" behaviour with empty values","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-08-14T22:21:04Z","receivedAt":"2017-08-14T22:21:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Heiduk <asheiduk@gmail.com> writes:\n\n>> However, I think this \"no value (but still with '=')\" is making it\n>> more confusing than necessary for two reasons.\n> [...]\n>  \n>> I notice that in this Values section (where the boolean:: is the\n>> first entry) there is no mention on how to spell a string value.\n>\n> I assumed this is due to the pretext of the definition list:\n>\n> \tValues of many variables are treated as a simple string, but there\n> \tare variables that take values of specific types and there are rules\n> \tas to how to spell them.\n\nI assumed so too.  \n\nBut if you knew that \"[section] var =\" is a valid way to spell an\nempty string, I'd thought that you wouldn't have written \"no value\nbut still with '=')\" there.\n\nThe description for \"true\" (i.e. \"[section] var\" and nothing else)\nis also spelled out perfectly well in the Syntax section, but it is\nduplicated in Values section.  I think that it is a good thing to\nhave the complete picture in a single Values section, without\nassuming readers to know what is in the other Syntax section.\n\nSo if it bothers you to have a non-specific \"string\" description in\nthe Values section, I think it would be more helpful to update the\npretext so that including the description of a simple string there\ndoes not look unnatural, IMHO.\n"},{"id":"326329","messageId":"xmqqh8x9u6sy.fsf@gitster.mtv.corp.google.com","threadId":"46581","inReplyTo":"20170814221218.18874-1-asheiduk@gmail.com","subject":"Re: [PATCH v2] doc: clarify \"config --bool\" behaviour with empty values","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-08-14T22:24:13Z","receivedAt":"2017-08-14T22:24:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Heiduk <asheiduk@gmail.com> writes:\n\n> `git config --bool xxx.yyy` returns `true` for `[xxx]yyy` but\n> `false` for `[xxx]yyy=` or `[xxx]yyy=\"\"`.  This is tested in\n> t1300-repo-config.sh since 09bc098c2.\n>\n> Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>\n> ---\n>  Documentation/config.txt | 10 +++++-----\n>  Documentation/git.txt    |  3 ++-\n>  2 files changed, 7 insertions(+), 6 deletions(-)\n\nThis looks good to me.  Will queue.\n\n\n\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index d5c9c4cab..478b9431e 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -216,15 +216,15 @@ boolean::\n>         synonyms are accepted for 'true' and 'false'; these are all\n>         case-insensitive.\n>  \n> -       true;; Boolean true can be spelled as `yes`, `on`, `true`,\n> -\t\tor `1`.  Also, a variable defined without `= <value>`\n> +\ttrue;; Boolean true literals are `yes`, `on`, `true`,\n> +\t\tand `1`.  Also, a variable defined without `= <value>`\n>  \t\tis taken as true.\n>  \n> -       false;; Boolean false can be spelled as `no`, `off`,\n> -\t\t`false`, or `0`.\n> +\tfalse;; Boolean false literals are `no`, `off`, `false`,\n> +\t\t`0` and the empty string.\n>  +\n>  When converting value to the canonical form using `--bool` type\n> -specifier; 'git config' will ensure that the output is \"true\" or\n> +specifier, 'git config' will ensure that the output is \"true\" or\n>  \"false\" (spelled in lowercase).\n>  \n>  integer::\n> diff --git a/Documentation/git.txt b/Documentation/git.txt\n> index 7dd5e0328..6e3a6767e 100644\n> --- a/Documentation/git.txt\n> +++ b/Documentation/git.txt\n> @@ -75,7 +75,8 @@ example the following invocations are equivalent:\n>  Note that omitting the `=` in `git -c foo.bar ...` is allowed and sets\n>  `foo.bar` to the boolean true value (just like `[foo]bar` would in a\n>  config file). Including the equals but with an empty value (like `git -c\n> -foo.bar= ...`) sets `foo.bar` to the empty string.\n> +foo.bar= ...`) sets `foo.bar` to the empty string which ` git config\n> +--bool` will convert to `false`.\n>  \n>  --exec-path[=<path>]::\n>  \tPath to wherever your core Git programs are installed.\n"}]}