{"thread":{"id":"62936","subject":"[PATCH] doc: centrally document various ways spell `true` and `false`","startedAt":"2025-02-11T17:20:09Z","lastAt":"2025-03-13T12:26:42Z","messageCount":5,"participants":["Junio C Hamano","Eric Sunshine","Taylor Blau"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"512241","messageId":"xmqqy0ycz9dk.fsf@gitster.g","threadId":"62936","inReplyTo":null,"subject":"[PATCH] doc: centrally document various ways spell `true` and `false`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-02-11T17:20:07Z","receivedAt":"2025-02-11T17:20:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"We do not seem to centrally document exhaustively ways to spell\nBoolean values.\n\nThe description in the Environment Variables of git(1) section\nassumes that the reader is already familiar with how \"Boolean valued\nconfiguration variables\" are specified, without referring to\nanything, so there is no way for the readers to find out more.\n\nThe description of `bool` in the section on \"--type\n<type>\" in \"git config --help\" might be the place to do so, but it\nis not telling us all that much.\n\nThe description of Boolean valued placeholders in the pretty formats\nsection of \"git log --help\" enumerates the possible values with \"etc.\"\nimplying there may be other synonyms; shrink the list of samples and\ninstead refer to the canonical and authoritative source of truth, which\nnow is git-config(1).\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * Noticed while writing <xmqqfrkk1l4i.fsf@gitster.g>, a review for\n   <bc0de52b59f289e1388f1581fcfa49453365e21a.camel@intelfx.name>\n\n Cc'ed Taylor, as the author of fb0dc3ba (builtin/config.c: support\n `--type=<type>` as preferred alias for `--<type>`, 2018-04-18) this\n patch butchers.\n\n Documentation/git-config.txt     | 4 +++-\n Documentation/git.txt            | 5 +++--\n Documentation/pretty-formats.txt | 8 ++++----\n 3 files changed, 10 insertions(+), 7 deletions(-)\n\ndiff --git c/Documentation/git-config.txt w/Documentation/git-config.txt\nindex 3e420177c1..76042581ec 100644\n--- c/Documentation/git-config.txt\n+++ w/Documentation/git-config.txt\n@@ -213,7 +213,9 @@ See also <<FILES>>.\n +\n Valid `<type>`'s include:\n +\n-- 'bool': canonicalize values as either \"true\" or \"false\".\n+- 'bool': canonicalize values `true`, `yes`,`on`, and positive\n+  numbers as \"true\", and values `false`, `no`, `off` and `0` as\n+  \"false\".\n - 'int': canonicalize values as simple decimal numbers. An optional suffix of\n   'k', 'm', or 'g' will cause the value to be multiplied by 1024, 1048576, or\n   1073741824 upon input.\ndiff --git c/Documentation/git.txt w/Documentation/git.txt\nindex e89a91dd0d..c029a297db 100644\n--- c/Documentation/git.txt\n+++ w/Documentation/git.txt\n@@ -472,8 +472,9 @@ Environment Variables\n ---------------------\n Various Git commands pay attention to environment variables and change\n their behavior.  The environment variables marked as \"Boolean\" take\n-their values the same way as Boolean valued configuration variables, e.g.\n-\"true\", \"yes\", \"on\" and positive numbers are taken as \"yes\".\n+their values the same way as Boolean valued configuration variables, i.e.,\n+\"true\", \"yes\", \"on\" and positive numbers are taken as \"yes\", while \"false\",\n+\"no\", \"off\", and \"0\" are taken as \"no\".\n \n Here are the variables:\n \ndiff --git c/Documentation/pretty-formats.txt w/Documentation/pretty-formats.txt\nindex 8ee940b6a4..07475de8c3 100644\n--- c/Documentation/pretty-formats.txt\n+++ w/Documentation/pretty-formats.txt\n@@ -339,10 +339,10 @@ insert an empty string unless we are traversing reflog entries (e.g., by\n decoration format if `--decorate` was not already provided on the command\n line.\n \n-The boolean options accept an optional value `[=<bool-value>]`. The values\n-`true`, `false`, `on`, `off` etc. are all accepted. See the \"boolean\"\n-sub-section in \"EXAMPLES\" in linkgit:git-config[1]. If a boolean\n-option is given with no value, it's enabled.\n+The boolean options accept an optional value `[=<bool-value>]`. The\n+values taken by `--type=bool` git-config[1], like `yes` and `off`,\n+are all accepted.  Giving a boolean option without `=<value>` is\n+equivalent to giving it with `=true`.\n \n If you add a `+` (plus sign) after '%' of a placeholder, a line-feed\n is inserted immediately before the expansion if and only if the\n"},{"id":"512244","messageId":"CAPig+cQ2miLtU1HXCcn7q6GqTPiBAqKT3gGOMoug1m0VHczN1g@mail.gmail.com","threadId":"62936","inReplyTo":"xmqqy0ycz9dk.fsf@gitster.g","subject":"Re: [PATCH] doc: centrally document various ways spell `true` and `false`","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2025-02-11T17:42:23Z","receivedAt":"2025-02-11T17:42:34Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Feb 11, 2025 at 12:21 PM Junio C Hamano <gitster@pobox.com> wrote:\n> doc: centrally document various ways spell `true` and `false`\n\ns/spell/to spell/\n"},{"id":"512248","messageId":"xmqqseokxsfc.fsf@gitster.g","threadId":"62936","inReplyTo":"CAPig+cQ2miLtU1HXCcn7q6GqTPiBAqKT3gGOMoug1m0VHczN1g@mail.gmail.com","subject":"Re: [PATCH] doc: centrally document various ways spell `true` and `false`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-02-11T18:11:35Z","receivedAt":"2025-02-11T18:11:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> On Tue, Feb 11, 2025 at 12:21 PM Junio C Hamano <gitster@pobox.com> wrote:\n>> doc: centrally document various ways spell `true` and `false`\n>\n> s/spell/to spell/\n\nYes, indeed.  Thanks for sharp eyes.\n"},{"id":"514133","messageId":"Z9IH6G7BnM0blOmH@nand.local","threadId":"62936","inReplyTo":"xmqqy0ycz9dk.fsf@gitster.g","subject":"Re: [PATCH] doc: centrally document various ways spell `true` and `false`","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2025-03-12T22:17:12Z","receivedAt":"2025-03-12T22:17:15Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Tue, Feb 11, 2025 at 09:20:07AM -0800, Junio C Hamano wrote:\n>  Cc'ed Taylor, as the author of fb0dc3ba (builtin/config.c: support\n>  `--type=<type>` as preferred alias for `--<type>`, 2018-04-18) this\n>  patch butchers.\n\nWow, this is a blast from the past. I think this was one of my first\ncontributions to Git, and indeed:\n\n    $ git log --oneline --author=Taylor.Blau --until=2018-04-18 | wc -l\n    9\n\n>  Documentation/git-config.txt     | 4 +++-\n>  Documentation/git.txt            | 5 +++--\n>  Documentation/pretty-formats.txt | 8 ++++----\n>  3 files changed, 10 insertions(+), 7 deletions(-)\n>\n> diff --git c/Documentation/git-config.txt w/Documentation/git-config.txt\n> index 3e420177c1..76042581ec 100644\n> --- c/Documentation/git-config.txt\n> +++ w/Documentation/git-config.txt\n> @@ -213,7 +213,9 @@ See also <<FILES>>.\n>  +\n>  Valid `<type>`'s include:\n>  +\n> -- 'bool': canonicalize values as either \"true\" or \"false\".\n> +- 'bool': canonicalize values `true`, `yes`,`on`, and positive\n> +  numbers as \"true\", and values `false`, `no`, `off` and `0` as\n> +  \"false\".\n\nI agree with the rest of the patch, but is this true (no pun intended\n;-))? I thought that we might canonicalize \"yes\" to \"yes\" if the value\nwe are asking about is already something other than a literal \"true\" or\n\"false\", but I don't think we do:\n\n    $ git.compile -c foo.bar=yes config --type=bool foo.bar\n    true\n\nSo I do think that it is worth saying \"you can spell 'true' as 'yes',\n'1', ...\" in the documentation, but I don't think that it is correct\nthat we'll canonicalize \"yes\" to \"true\" in the case described here.\n\nSorry that this took me so long to respond to. I think I must have\nmissed it when you wrote it and I only noticed it today while cleaning\nup old emails.\n\nThanks,\nTaylor\n"},{"id":"514176","messageId":"xmqqh63xru9s.fsf@gitster.g","threadId":"62936","inReplyTo":"Z9IH6G7BnM0blOmH@nand.local","subject":"Re: [PATCH] doc: centrally document various ways spell `true` and `false`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-03-13T12:26:39Z","receivedAt":"2025-03-13T12:26:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Taylor Blau <me@ttaylorr.com> writes:\n\n>> +- 'bool': canonicalize values `true`, `yes`,`on`, and positive\n>> +  numbers as \"true\", and values `false`, `no`, `off` and `0` as\n>> +  \"false\".\n> ...\n> I agree with the rest of the patch, but is this true (no pun intended\n> ;-))? I thought that we might canonicalize \"yes\" to \"yes\" if the value\n> we are asking about is already something other than a literal \"true\" or\n> \"false\", but I don't think we do:\n>\n>     $ git.compile -c foo.bar=yes config --type=bool foo.bar\n>     true\n\nSorry, but you lost me.  Isn't the above demonstration of 'yes' you\ngave getting canonicalized to 'true'?\n\n\t$ for v in yes 1 2 on\n\t> do\n\t>    git -c foo.bar=$v config --type=bool foo.bar\n\t> done\n\ttrue\n\ttrue\n\ttrue\n\ttrue\n\nOr are you saying that the above documents what happens, but you\nthink the code is wrong to do so?\n\n\n> So I do think that it is worth saying \"you can spell 'true' as 'yes',\n> '1', ...\" in the documentation, but I don't think that it is correct\n> that we'll canonicalize \"yes\" to \"true\" in the case described here.\n"}]}