{"thread":{"id":"58432","subject":"BUG: Value for GIT_SSL_NO_VERIFY has no effect","startedAt":"2022-09-15T01:47:06Z","lastAt":"2023-01-06T09:10:45Z","messageCount":19,"participants":["Brijesh Patel","brian m. carlson","Junio C Hamano","Todd Zullinger","René Scharfe","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"463026","messageId":"CACs=J2MLnawNF5mp19sCJAZADPenHjWVZvKW5rM1fwELHjqqyg@mail.gmail.com","threadId":"58432","inReplyTo":null,"subject":"BUG: Value for GIT_SSL_NO_VERIFY has no effect","fromName":"Brijesh Patel","fromEmail":"bridgepatel@gmail.com","sentAt":"2022-09-15T01:46:50Z","receivedAt":"2022-09-15T01:47:06Z","isPatch":false,"sender":{"key":"bridgepatel@gmail.com","avatar":null},"body":"Hi,\n\nIt appears that any value assigned to GIT_SSL_NO_VERIFY (true or\nfalse) has no effect on the GIT operations. For testing purposes, we\nhave created a host entry for github.com and mapped it to foo.com.\n\nStep 1: Clone the repo with default configuration.\n\ngit clone https://foo.com/bridgepate/gs_auto_provision.git\nCloning into 'gs_auto_provision'...\nfatal: unable to access\n'https://foo.com/bridgepate/gs_auto_provision.git/': SSL: certificate\nsubject name (github.com) does not match target host name 'foo.com'\n\nAs expected, the above fails with SSL certificate error.\n\nStep 2:  Clone with GIT_SSL_NO_VERIFY set to true\n\nGIT_SSL_NO_VERIFY=true git clone\nhttps://foo.com/bridgepate/gs_auto_provision.git\nCloning into 'gs_auto_provision'...\nwarning: redirecting to https://github.com/bridgepate/gs_auto_provision.git/\nremote: Enumerating objects: 244, done.\nremote: Counting objects: 100% (3/3), done.\nremote: Compressing objects: 100% (3/3), done.\nremote: Total 244 (delta 0), reused 1 (delta 0), pack-reused 241\nReceiving objects: 100% (244/244), 108.75 KiB | 611.00 KiB/s, done.\nResolving deltas: 100% (131/131), done.\n\nThe above works as expected.\n\nStep 3:  Clone with GIT_SSL_NO_VERIFY to false\n\nGIT_SSL_NO_VERIFY=false git clone\nhttps://foo.com/bridgepate/gs_auto_provision.git\nCloning into 'gs_auto_provision'...\nwarning: redirecting to https://github.com/bridgepate/gs_auto_provision.git/\nremote: Enumerating objects: 244, done.\nremote: Counting objects: 100% (3/3), done.\nremote: Compressing objects: 100% (3/3), done.\nremote: Total 244 (delta 0), reused 1 (delta 0), pack-reused 241\nReceiving objects: 100% (244/244), 108.75 KiB | 1.38 MiB/s, done.\nResolving deltas: 100% (131/131), done.\n\nWe expect the above to fail as we saw in step 1, but it succeeded.\nThis shows that the value for this environment variable is ignored.\n\nFollowing is the platform details\n\nOS: Ubuntu 22.04.1 LTS\nGIT: git version 2.34.1\n\nThanks in advance\n\nBrijesh Patel\n"},{"id":"463038","messageId":"YyMi76Cy7KnfZFU4@tapette.crustytoothpaste.net","threadId":"58432","inReplyTo":"CACs=J2MLnawNF5mp19sCJAZADPenHjWVZvKW5rM1fwELHjqqyg@mail.gmail.com","subject":"Re: BUG: Value for GIT_SSL_NO_VERIFY has no effect","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2022-09-15T13:04:47Z","receivedAt":"2022-09-15T13:04:56Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2022-09-15 at 01:46:50, Brijesh Patel wrote:\n> Hi,\n\nHey,\n\n> It appears that any value assigned to GIT_SSL_NO_VERIFY (true or\n> false) has no effect on the GIT operations. For testing purposes, we\n> have created a host entry for github.com and mapped it to foo.com.\n\nThis is definitely true.  There are several Git environment variables\nthat act this way, including GIT_CURL_VERBOSE, that check whether the\nenvironment is present or absent, not whether it's set to a particular\nvalue.\n\nI believe this behaviour is by design (although other folks are free to\ncorrect me if they think I'e wrong).\n-- \nbrian m. carlson (he/him or they/them)\nToronto, Ontario, CA\n"},{"id":"463046","messageId":"xmqq8rmkpsit.fsf@gitster.g","threadId":"58432","inReplyTo":"YyMi76Cy7KnfZFU4@tapette.crustytoothpaste.net","subject":"Re: BUG: Value for GIT_SSL_NO_VERIFY has no effect","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-09-15T15:27:22Z","receivedAt":"2022-09-15T15:27:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> On 2022-09-15 at 01:46:50, Brijesh Patel wrote:\n>> Hi,\n>\n> Hey,\n>\n>> It appears that any value assigned to GIT_SSL_NO_VERIFY (true or\n>> false) has no effect on the GIT operations. For testing purposes, we\n>> have created a host entry for github.com and mapped it to foo.com.\n>\n> This is definitely true.  There are several Git environment variables\n> that act this way, including GIT_CURL_VERBOSE, that check whether the\n> environment is present or absent, not whether it's set to a particular\n> value.\n>\n> I believe this behaviour is by design (although other folks are free to\n> correct me if they think I'e wrong).\n\nYeah, a plausible alternative that could have existed is to name the\nvariable GIT_SSL_VERIFY with the boolean (or the usual Boolean +\n'auto', even though I do not offhand think of what 'auto' should\ndo), but this variable definitely is designed to be \"if set, the\nfeature named by the variable goes in effect, and you unset it to\nmake it ineffective\".\n\nI did a quick audit of the environment variables documented in\ngit(1) and it is a bit messy.  Many environment variables use\ngit_env_bool() to make themselves a proper Boolean environment\nvariable, but some others that are described to take \"1\" to \"enable\"\ndo not honor the usual \"yes/true/on\" convention.\n\nSSL_NO_VERIFY is worse, as it is not even described.  So we should\nadd it to \"git help git\".\n\n Documentation/git.txt | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git c/Documentation/git.txt i/Documentation/git.txt\nindex 0ef7f5e4ec..1b7e37e79a 100644\n--- c/Documentation/git.txt\n+++ i/Documentation/git.txt\n@@ -682,6 +682,11 @@ for further details.\n \tplink or tortoiseplink. This variable overrides the config setting\n \t`ssh.variant` that serves the same purpose.\n \n+`GIT_SSL_NO_VERIFY`::\n+\tSetting and exporting this environment variable to any value\n+\ttells Git not to verify the SSL certificate when fetching or\n+\tpushing over HTTPS.\n+\n `GIT_ASKPASS`::\n \tIf this environment variable is set, then Git commands which need to\n \tacquire passwords or passphrases (e.g. for HTTP or IMAP authentication)\n"},{"id":"463047","messageId":"20220915160659.126441-1-gitster@pobox.com","threadId":"58432","inReplyTo":"xmqq8rmkpsit.fsf@gitster.g","subject":"[PATCH 0/5] Update docs on GIT_* environment variables","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-09-15T16:06:54Z","receivedAt":"2022-09-15T16:09:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Historically the environment variables that affect the behaviour of\nGit have been the least well designed part of the system, as they\nwere haphazardly added as the authors of new features find a need to\n\"tweak\" and use of getenv() the simplest way to implement.\n\nAlthough many use git_env_bool() to implement the parsing of a\nBoolean value, some use handcrafted \"ask atoi() to see if it yields\n0\", some use \"mere existence is sufficient to signal true\".\n\nHere is a result of my quick audit of environment variables\nmentioned in \"git help git\".\n\n * GIT_SSL_NO_VERIFY was mentioned in description of http.sslVerify\n   but there was no description.\n\n * Many that used git_env_bool() explained acceptable \"true\"\n   randomly as '1' or 'yes'.  Introduce and explain the concept of\n   \"Boolean environment variable\" and mark them as such.\n\n * GIT_FLUSH is an oddball that used atoi() and not git_env_bool();\n   leave a NEEDSWORK: comment to fix it later.\n\nThe last two are \"I found them questionable while I was reviewing\nthe description\" and are not about Boolean variables.\n\nJunio C Hamano (5):\n  environ: document GIT_SSL_NO_VERIFY\n  environ: explain Boolean environment variables\n  environ: GIT_FLUSH should be made a usual Boolean\n  environ: simplify description of GIT_INDEX_FILE\n  environ: GIT_INDEX_VERSION affects not just a new repository\n\n Documentation/git.txt | 43 +++++++++++++++++++++++++++----------------\n write-or-die.c        |  1 +\n 2 files changed, 28 insertions(+), 16 deletions(-)\n\n-- \n2.37.3-780-gd940517dcb\n\n"},{"id":"463048","messageId":"20220915160659.126441-3-gitster@pobox.com","threadId":"58432","inReplyTo":"20220915160659.126441-1-gitster@pobox.com","subject":"[PATCH 2/5] environ: explain Boolean environment variables","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-09-15T16:06:56Z","receivedAt":"2022-09-15T16:09:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Many environment variables use the git_env_bool() API to parse their\nvalues, and allow the usual \"true/yes/on are true, false/no/off are\nfalse. In addition non-zero numbers are true and zero is false.  An\nempty string is also false.\" set of values.\n\nMark them as such, and consistently say \"true\" or \"false\", instead\nof random mixes of '1', '0', 'yes', 'true', etc. in their\ndescription.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git.txt | 31 ++++++++++++++++++-------------\n 1 file changed, 18 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 1b7e37e79a..e2f61a1ec8 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -458,7 +458,12 @@ Please see linkgit:gitglossary[7].\n \n Environment Variables\n ---------------------\n-Various Git commands use the following environment variables:\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+\n+Here are the variables:\n \n The Git Repository\n ~~~~~~~~~~~~~~~~~~\n@@ -530,7 +535,7 @@ double-quotes and respecting backslash escapes. E.g., the value\n \tWhen run in a directory that does not have \".git\" repository\n \tdirectory, Git tries to find such a directory in the parent\n \tdirectories to find the top of the working tree, but by default it\n-\tdoes not cross filesystem boundaries.  This environment variable\n+\tdoes not cross filesystem boundaries.  This Boolean environment variable\n \tcan be set to true to tell Git not to stop at filesystem\n \tboundaries.  Like `GIT_CEILING_DIRECTORIES`, this will not affect\n \tan explicit repository directory set via `GIT_DIR` or on the\n@@ -695,7 +700,7 @@ for further details.\n \toption in linkgit:git-config[1].\n \n `GIT_TERMINAL_PROMPT`::\n-\tIf this environment variable is set to `0`, git will not prompt\n+\tIf this Boolean environment variable is set to false, git will not prompt\n \ton the terminal (e.g., when asking for HTTP authentication).\n \n `GIT_CONFIG_GLOBAL`::\n@@ -710,10 +715,10 @@ for further details.\n \n `GIT_CONFIG_NOSYSTEM`::\n \tWhether to skip reading settings from the system-wide\n-\t`$(prefix)/etc/gitconfig` file.  This environment variable can\n+\t`$(prefix)/etc/gitconfig` file.  This Boolean environment variable can\n \tbe used along with `$HOME` and `$XDG_CONFIG_HOME` to create a\n \tpredictable environment for a picky script, or you can set it\n-\ttemporarily to avoid using a buggy `/etc/gitconfig` file while\n+\tto true to temporarily avoid using a buggy `/etc/gitconfig` file while\n \twaiting for someone with sufficient permissions to fix it.\n \n `GIT_FLUSH`::\n@@ -857,11 +862,11 @@ for full details.\n `GIT_TRACE_REDACT`::\n \tBy default, when tracing is activated, Git redacts the values of\n \tcookies, the \"Authorization:\" header, the \"Proxy-Authorization:\"\n-\theader and packfile URIs. Set this variable to `0` to prevent this\n+\theader and packfile URIs. Set this Boolean environment variable to false to prevent this\n \tredaction.\n \n `GIT_LITERAL_PATHSPECS`::\n-\tSetting this variable to `1` will cause Git to treat all\n+\tSetting this Boolean environment variable to true will cause Git to treat all\n \tpathspecs literally, rather than as glob patterns. For example,\n \trunning `GIT_LITERAL_PATHSPECS=1 git log -- '*.c'` will search\n \tfor commits that touch the path `*.c`, not any paths that the\n@@ -870,15 +875,15 @@ for full details.\n \t`git ls-tree`, `--raw` diff output, etc).\n \n `GIT_GLOB_PATHSPECS`::\n-\tSetting this variable to `1` will cause Git to treat all\n+\tSetting this Boolean environment variable to true will cause Git to treat all\n \tpathspecs as glob patterns (aka \"glob\" magic).\n \n `GIT_NOGLOB_PATHSPECS`::\n-\tSetting this variable to `1` will cause Git to treat all\n+\tSetting this Boolean environment variable to true will cause Git to treat all\n \tpathspecs as literal (aka \"literal\" magic).\n \n `GIT_ICASE_PATHSPECS`::\n-\tSetting this variable to `1` will cause Git to treat all\n+\tSetting this Boolean environment variable to true will cause Git to treat all\n \tpathspecs as case-insensitive.\n \n `GIT_REFLOG_ACTION`::\n@@ -892,7 +897,7 @@ for full details.\n \tend user, to be recorded in the body of the reflog.\n \n `GIT_REF_PARANOIA`::\n-\tIf set to `0`, ignore broken or badly named refs when iterating\n+\tIf this Boolean environment variable is set to false, ignore broken or badly named refs when iterating\n \tover lists of refs. Normally Git will try to include any such\n \trefs, which may cause some operations to fail. This is usually\n \tpreferable, as potentially destructive operations (e.g.,\n@@ -911,7 +916,7 @@ for full details.\n \t`protocol.allow` in linkgit:git-config[1] for more details.\n \n `GIT_PROTOCOL_FROM_USER`::\n-\tSet to 0 to prevent protocols used by fetch/push/clone which are\n+\tSet this Boolean environment variable to false to prevent protocols used by fetch/push/clone which are\n \tconfigured to the `user` state.  This is useful to restrict recursive\n \tsubmodule initialization from an untrusted repository or for programs\n \twhich feed potentially-untrusted URLS to git commands.  See\n@@ -939,7 +944,7 @@ only affects clones and fetches; it is not yet used for pushes (but may\n be in the future).\n \n `GIT_OPTIONAL_LOCKS`::\n-\tIf set to `0`, Git will complete any requested operation without\n+\tIf this Boolean environment variable is set to false, Git will complete any requested operation without\n \tperforming any optional sub-operations that require taking a lock.\n \tFor example, this will prevent `git status` from refreshing the\n \tindex as a side effect. This is useful for processes running in\n-- \n2.37.3-780-gd940517dcb\n\n"},{"id":"463049","messageId":"20220915160659.126441-6-gitster@pobox.com","threadId":"58432","inReplyTo":"20220915160659.126441-1-gitster@pobox.com","subject":"[PATCH 5/5] environ: GIT_INDEX_VERSION affects not just a new repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-09-15T16:06:59Z","receivedAt":"2022-09-15T16:11:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The variable is consulted whenever we write the index file.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git.txt | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 535ff561c6..eb2a17d36b 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -477,8 +477,8 @@ Git so take care if using a foreign front-end.\n \tis used.\n \n `GIT_INDEX_VERSION`::\n-\tThis environment variable allows the specification of an index\n-\tversion for new repositories.  It won't affect existing index\n+\tThis environment variable specifies what index version is used\n+\twhen writing the index file out.  It won't affect existing index\n \tfiles.  By default index file version 2 or 3 is used. See\n \tlinkgit:git-update-index[1] for more information.\n \n-- \n2.37.3-780-gd940517dcb\n\n"},{"id":"463050","messageId":"20220915160659.126441-2-gitster@pobox.com","threadId":"58432","inReplyTo":"20220915160659.126441-1-gitster@pobox.com","subject":"[PATCH 1/5] environ: document GIT_SSL_NO_VERIFY","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-09-15T16:06:55Z","receivedAt":"2022-09-15T16:11:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Even though the name of the environment variable is mentioned in\n\"git config --help\" from http.sslVerify, there is no description for\nit.  Add one.\n\nNote that this is not a usual Boolean environment variable whose\nvalue can be yes/true/on vs no/false/off; the existence of it is\nenough to trigger the feature named by the variable.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git.txt | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 0ef7f5e4ec..1b7e37e79a 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -682,6 +682,11 @@ for further details.\n \tplink or tortoiseplink. This variable overrides the config setting\n \t`ssh.variant` that serves the same purpose.\n \n+`GIT_SSL_NO_VERIFY`::\n+\tSetting and exporting this environment variable to any value\n+\ttells Git not to verify the SSL certificate when fetching or\n+\tpushing over HTTPS.\n+\n `GIT_ASKPASS`::\n \tIf this environment variable is set, then Git commands which need to\n \tacquire passwords or passphrases (e.g. for HTTP or IMAP authentication)\n-- \n2.37.3-780-gd940517dcb\n\n"},{"id":"463051","messageId":"20220915160659.126441-4-gitster@pobox.com","threadId":"58432","inReplyTo":"20220915160659.126441-1-gitster@pobox.com","subject":"[PATCH 3/5] environ: GIT_FLUSH should be made a usual Boolean","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-09-15T16:06:57Z","receivedAt":"2022-09-15T16:11:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This uses atoi() and checks if the result is not zero to decide what\nto do.  Turning it into the usual Boolean environment variable to\nuse git_env_bool() would not break those who have been using \"set to\n0, or set to non-zero, that can be parsed with atoi()\" values, but\nwill match the expectation of those who expected \"true\" to mean\n\"yes\".\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git.txt | 1 +\n write-or-die.c        | 1 +\n 2 files changed, 2 insertions(+)\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex e2f61a1ec8..3d31252bf2 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -722,6 +722,7 @@ for further details.\n \twaiting for someone with sufficient permissions to fix it.\n \n `GIT_FLUSH`::\n+// NEEDSWORK: make it into a usual Boolean environment variable\n \tIf this environment variable is set to \"1\", then commands such\n \tas 'git blame' (in incremental mode), 'git rev-list', 'git log',\n \t'git check-attr' and 'git check-ignore' will\ndiff --git a/write-or-die.c b/write-or-die.c\nindex c4fd91b5b4..aaa0318e82 100644\n--- a/write-or-die.c\n+++ b/write-or-die.c\n@@ -23,6 +23,7 @@ void maybe_flush_or_die(FILE *f, const char *desc)\n \n \tif (f == stdout) {\n \t\tif (skip_stdout_flush < 0) {\n+\t\t\t/* NEEDSWORK: make this a normal Boolean */\n \t\t\tcp = getenv(\"GIT_FLUSH\");\n \t\t\tif (cp)\n \t\t\t\tskip_stdout_flush = (atoi(cp) == 0);\n-- \n2.37.3-780-gd940517dcb\n\n"},{"id":"463052","messageId":"20220915160659.126441-5-gitster@pobox.com","threadId":"58432","inReplyTo":"20220915160659.126441-1-gitster@pobox.com","subject":"[PATCH 4/5] environ: simplify description of GIT_INDEX_FILE","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-09-15T16:06:58Z","receivedAt":"2022-09-15T16:12:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Signed-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 3d31252bf2..535ff561c6 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -472,7 +472,7 @@ is worth noting that they may be used/overridden by SCMS sitting above\n Git so take care if using a foreign front-end.\n \n `GIT_INDEX_FILE`::\n-\tThis environment allows the specification of an alternate\n+\tThis environment specifies an alternate\n \tindex file. If not specified, the default of `$GIT_DIR/index`\n \tis used.\n \n-- \n2.37.3-780-gd940517dcb\n\n"},{"id":"463053","messageId":"YyNPp3UMCii67ugC@tapette.crustytoothpaste.net","threadId":"58432","inReplyTo":"xmqq8rmkpsit.fsf@gitster.g","subject":"Re: BUG: Value for GIT_SSL_NO_VERIFY has no effect","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2022-09-15T16:15:35Z","receivedAt":"2022-09-15T16:15:41Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2022-09-15 at 15:27:22, Junio C Hamano wrote:\n> I did a quick audit of the environment variables documented in\n> git(1) and it is a bit messy.  Many environment variables use\n> git_env_bool() to make themselves a proper Boolean environment\n> variable, but some others that are described to take \"1\" to \"enable\"\n> do not honor the usual \"yes/true/on\" convention.\n\nYeah.  I think we could well adjust this to accept \"0\" or \"false\" to\nturn it off if we liked, but it doesn't right now.  I think that could\nwell be valuable if we wanted to make a change in the future.\n\nI could submit a patch to do this over the next couple of days for this\nvariable and GIT_CURL_VERBOSE as well if we decide we want to do so.\n\n> SSL_NO_VERIFY is worse, as it is not even described.  So we should\n> add it to \"git help git\".\n\nIt is documented in git-config(1), but of course we should also document\nin git(1) as suggested.  Do you want to turn this into a nice patch or\nwould you prefer that I turned it into one with your sign-off?\n-- \nbrian m. carlson (he/him or they/them)\nToronto, Ontario, CA\n"},{"id":"463057","messageId":"xmqqwna4ms2d.fsf@gitster.g","threadId":"58432","inReplyTo":"YyNPp3UMCii67ugC@tapette.crustytoothpaste.net","subject":"Re: BUG: Value for GIT_SSL_NO_VERIFY has no effect","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-09-15T18:05:30Z","receivedAt":"2022-09-15T18:05:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n>> SSL_NO_VERIFY is worse, as it is not even described.  So we should\n>> add it to \"git help git\".\n>\n> It is documented in git-config(1), but of course we should also document\n> in git(1) as suggested.  Do you want to turn this into a nice patch or\n> would you prefer that I turned it into one with your sign-off?\n\nIt seems our mails crossed ;-)\n"},{"id":"463080","messageId":"YySYq94EEGfwXMjd@pobox.com","threadId":"58432","inReplyTo":"20220915160659.126441-5-gitster@pobox.com","subject":"Re: [PATCH 4/5] environ: simplify description of GIT_INDEX_FILE","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2022-09-16T15:39:23Z","receivedAt":"2022-09-16T15:39:43Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"Junio C Hamano wrote:\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  Documentation/git.txt | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/Documentation/git.txt b/Documentation/git.txt\n> index 3d31252bf2..535ff561c6 100644\n> --- a/Documentation/git.txt\n> +++ b/Documentation/git.txt\n> @@ -472,7 +472,7 @@ is worth noting that they may be used/overridden by SCMS sitting above\n>  Git so take care if using a foreign front-end.\n>  \n>  `GIT_INDEX_FILE`::\n> -\tThis environment allows the specification of an alternate\n> +\tThis environment specifies an alternate\n\nWhile here, `s/environment/& variable/` would make this a\nbit easier to read and more consistent with the nearby\ndescriptions.\n\n-- \nTodd\n"},{"id":"463092","messageId":"xmqqk063i80m.fsf@gitster.g","threadId":"58432","inReplyTo":"YySYq94EEGfwXMjd@pobox.com","subject":"Re: [PATCH 4/5] environ: simplify description of GIT_INDEX_FILE","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-09-16T16:44:25Z","receivedAt":"2022-09-16T16:44:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Todd Zullinger <tmz@pobox.com> writes:\n\n> Junio C Hamano wrote:\n>> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n>> ---\n>>  Documentation/git.txt | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>> \n>> diff --git a/Documentation/git.txt b/Documentation/git.txt\n>> index 3d31252bf2..535ff561c6 100644\n>> --- a/Documentation/git.txt\n>> +++ b/Documentation/git.txt\n>> @@ -472,7 +472,7 @@ is worth noting that they may be used/overridden by SCMS sitting above\n>>  Git so take care if using a foreign front-end.\n>>  \n>>  `GIT_INDEX_FILE`::\n>> -\tThis environment allows the specification of an alternate\n>> +\tThis environment specifies an alternate\n>\n> While here, `s/environment/& variable/` would make this a\n> bit easier to read and more consistent with the nearby\n> descriptions.\n\nAbsolutely.  Thanks!\n"},{"id":"469771","messageId":"c58476c9-f7d1-bea4-17eb-c5346790df2e@web.de","threadId":"58432","inReplyTo":"20220915160659.126441-4-gitster@pobox.com","subject":"Re: [PATCH 3/5] environ: GIT_FLUSH should be made a usual Boolean","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2023-01-03T17:18:32Z","receivedAt":"2023-01-03T17:18:48Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 15.09.22 um 18:06 schrieb Junio C Hamano:\n> This uses atoi() and checks if the result is not zero to decide what\n> to do.  Turning it into the usual Boolean environment variable to\n> use git_env_bool() would not break those who have been using \"set to\n> 0, or set to non-zero, that can be parsed with atoi()\" values, but\n> will match the expectation of those who expected \"true\" to mean\n> \"yes\".\n>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  Documentation/git.txt | 1 +\n>  write-or-die.c        | 1 +\n>  2 files changed, 2 insertions(+)\n>\n> diff --git a/Documentation/git.txt b/Documentation/git.txt\n> index e2f61a1ec8..3d31252bf2 100644\n> --- a/Documentation/git.txt\n> +++ b/Documentation/git.txt\n> @@ -722,6 +722,7 @@ for further details.\n>  \twaiting for someone with sufficient permissions to fix it.\n>\n>  `GIT_FLUSH`::\n> +// NEEDSWORK: make it into a usual Boolean environment variable\n>  \tIf this environment variable is set to \"1\", then commands such\n>  \tas 'git blame' (in incremental mode), 'git rev-list', 'git log',\n>  \t'git check-attr' and 'git check-ignore' will\n> diff --git a/write-or-die.c b/write-or-die.c\n> index c4fd91b5b4..aaa0318e82 100644\n> --- a/write-or-die.c\n> +++ b/write-or-die.c\n> @@ -23,6 +23,7 @@ void maybe_flush_or_die(FILE *f, const char *desc)\n>\n>  \tif (f == stdout) {\n>  \t\tif (skip_stdout_flush < 0) {\n> +\t\t\t/* NEEDSWORK: make this a normal Boolean */\n>  \t\t\tcp = getenv(\"GIT_FLUSH\");\n\nOK, how about this?\n\n--- >8 ---\nSubject: [PATCH] environ: use git_parse_maybe_bool() for GIT_FLUSH\n\nAccept textual boolean values like \"true\" and \"false\" for GIT_FLUSH by\nusing git_parse_maybe_bool() to parse the variable's value.  Here's\nhow this changes whether to flush:\n\n                       before                  with this patch\n---------------------- ----------------------- -----------------------\n(unset)                if stdin is not a file  if stdin is not a file\nGIT_FLUSH=             no                      no\nGIT_FLUSH=0            no                      no\nGIT_FLUSH=1\t       yes                     yes\nGIT_FLUSH=false        no                      no\nGIT_FLUSH=true         no                      yes\nGIT_FLUSH=bogus        no                      if stdin is not a file\nGIT_FLUSH=10000000000  yes                     if stdin is not a file\n\nThe patch looks big because it reverses the meaning of the variable\nskip_stdout_flush.  The non-negated flush_stdout maps directly to the\nreturn value of git_parse_maybe_bool() (0 false, 1 true, -1 invalid).\n\nThis implementation ignores invalid values, and doesn't even report\nthem, as before.  If we want to do that then we need to stop parsing\nthe variable lazily, in order to report errors before the first\noutput is written -- in maybe_flush_or_die() it's too late.\n\nRequested-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n Documentation/git.txt | 10 ++++------\n write-or-die.c        | 18 +++++++++---------\n 2 files changed, 13 insertions(+), 15 deletions(-)\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 1d33e083ab..3ce0df983c 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -722,15 +722,13 @@ for further details.\n \twaiting for someone with sufficient permissions to fix it.\n\n `GIT_FLUSH`::\n-// NEEDSWORK: make it into a usual Boolean environment variable\n-\tIf this environment variable is set to \"1\", then commands such\n+\tIf this Boolean environment variable is set to true, then commands such\n \tas 'git blame' (in incremental mode), 'git rev-list', 'git log',\n \t'git check-attr' and 'git check-ignore' will\n \tforce a flush of the output stream after each record have been\n-\tflushed. If this\n-\tvariable is set to \"0\", the output of these commands will be done\n-\tusing completely buffered I/O.   If this environment variable is\n-\tnot set, Git will choose buffered or record-oriented flushing\n+\tflushed.  If it is set to false, then the output of these commands will\n+\tbe done using completely buffered I/O.  If unset or set to an invalid\n+\tvalue, Git will choose buffered or record-oriented flushing\n \tbased on whether stdout appears to be redirected to a file or not.\n\n `GIT_TRACE`::\ndiff --git a/write-or-die.c b/write-or-die.c\nindex aaa0318e82..444e72b69a 100644\n--- a/write-or-die.c\n+++ b/write-or-die.c\n@@ -17,23 +17,23 @@\n  */\n void maybe_flush_or_die(FILE *f, const char *desc)\n {\n-\tstatic int skip_stdout_flush = -1;\n+\tstatic int flush_stdout = -1;\n \tstruct stat st;\n \tchar *cp;\n\n \tif (f == stdout) {\n-\t\tif (skip_stdout_flush < 0) {\n-\t\t\t/* NEEDSWORK: make this a normal Boolean */\n+\t\tif (flush_stdout < 0) {\n \t\t\tcp = getenv(\"GIT_FLUSH\");\n \t\t\tif (cp)\n-\t\t\t\tskip_stdout_flush = (atoi(cp) == 0);\n-\t\t\telse if ((fstat(fileno(stdout), &st) == 0) &&\n-\t\t\t\t S_ISREG(st.st_mode))\n-\t\t\t\tskip_stdout_flush = 1;\n+\t\t\t\tflush_stdout = git_parse_maybe_bool(cp);\n+\t\t}\n+\t\tif (flush_stdout < 0) {\n+\t\t\tif (!fstat(fileno(stdout), &st) && S_ISREG(st.st_mode))\n+\t\t\t\tflush_stdout = 0;\n \t\t\telse\n-\t\t\t\tskip_stdout_flush = 0;\n+\t\t\t\tflush_stdout = 1;\n \t\t}\n-\t\tif (skip_stdout_flush && !ferror(f))\n+\t\tif (!flush_stdout && !ferror(f))\n \t\t\treturn;\n \t}\n \tif (fflush(f)) {\n--\n2.39.0\n"},{"id":"469780","messageId":"xmqqwn62u7nh.fsf@gitster.g","threadId":"58432","inReplyTo":"c58476c9-f7d1-bea4-17eb-c5346790df2e@web.de","subject":"Re: [PATCH 3/5] environ: GIT_FLUSH should be made a usual Boolean","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-01-04T06:37:54Z","receivedAt":"2023-01-04T06:37:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"René Scharfe <l.s.r@web.de> writes:\n\n> Subject: [PATCH] environ: use git_parse_maybe_bool() for GIT_FLUSH\n>\n> Accept textual boolean values like \"true\" and \"false\" for GIT_FLUSH by\n> using git_parse_maybe_bool() to parse the variable's value.  Here's\n> how this changes whether to flush:\n>\n>                        before                  with this patch\n> ---------------------- ----------------------- -----------------------\n> (unset)                if stdin is not a file  if stdin is not a file\n> GIT_FLUSH=             no                      no\n> GIT_FLUSH=0            no                      no\n> GIT_FLUSH=1\t       yes                     yes\n> GIT_FLUSH=false        no                      no\n> GIT_FLUSH=true         no                      yes\n> GIT_FLUSH=bogus        no                      if stdin is not a file\n\nThe above looks easy to grok, but the following caught my eyes.\n\n> GIT_FLUSH=10000000000  yes                     if stdin is not a file\n\nIs this because the int is so large that git_parse_signed() notices\nthat it is out of bound (hence \"bogus\")?\n\n> Requested-by: Junio C Hamano <gitster@pobox.com>\n> Signed-off-by: René Scharfe <l.s.r@web.de>\n> ---\n>  Documentation/git.txt | 10 ++++------\n>  write-or-die.c        | 18 +++++++++---------\n>  2 files changed, 13 insertions(+), 15 deletions(-)\n\nI may have suggested it, but don't think I requested ;-)\n\nThe patch text looks good.  Thanks.\n"},{"id":"469782","messageId":"Y7Ury+2n77XBzNl+@coredump.intra.peff.net","threadId":"58432","inReplyTo":"c58476c9-f7d1-bea4-17eb-c5346790df2e@web.de","subject":"Re: [PATCH 3/5] environ: GIT_FLUSH should be made a usual Boolean","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-01-04T07:33:31Z","receivedAt":"2023-01-04T07:33:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 03, 2023 at 06:18:32PM +0100, René Scharfe wrote:\n\n>                        before                  with this patch\n> ---------------------- ----------------------- -----------------------\n> (unset)                if stdin is not a file  if stdin is not a file\n> GIT_FLUSH=             no                      no\n> GIT_FLUSH=0            no                      no\n> GIT_FLUSH=1\t       yes                     yes\n> GIT_FLUSH=false        no                      no\n> GIT_FLUSH=true         no                      yes\n> GIT_FLUSH=bogus        no                      if stdin is not a file\n> GIT_FLUSH=10000000000  yes                     if stdin is not a file\n\nThese last two are unlike most of our other boolean variables, where we\ncomplain about bad values:\n\n  $ GIT_TEST_ASSUME_DIFFERENT_OWNER=bogus git rev-parse\n  fatal: bad boolean config value 'bogus' for 'GIT_TEST_ASSUME_DIFFERENT_OWNER'\n\n  $ GIT_LITERAL_PATHSPECS=10000000000 git rev-list HEAD -- foo\n  fatal: bad boolean config value '10000000000' for 'GIT_LITERAL_PATHSPECS'\n\n> This implementation ignores invalid values, and doesn't even report\n> them, as before.  If we want to do that then we need to stop parsing\n> the variable lazily, in order to report errors before the first\n> output is written -- in maybe_flush_or_die() it's too late.\n\nWhy is it too late then? If we're going to do a hard die() anyway (as\nabove), whether it happens after a bit of output or not doesn't seem\nlike that big a deal. And if we never flush and look at the variable,\nand the user \"gets away\" with a bogus value, nothing is harmed. That's\nhow existing variables work (e.g., try removing the pathspec from the\nrev-list invocation above).\n\nIf that behavior is OK, then we could just use git_env_bool() here\n(though the patch size isn't much different; as you noted, most of the\nchange comes from flipping the variable).\n\n-Peff\n"},{"id":"469788","messageId":"7ccf9109-1566-a2b9-5ca8-067ebf49706d@web.de","threadId":"58432","inReplyTo":"xmqqwn62u7nh.fsf@gitster.g","subject":"Re: [PATCH 3/5] environ: GIT_FLUSH should be made a usual Boolean","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2023-01-04T16:36:13Z","receivedAt":"2023-01-04T16:36:25Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 04.01.23 um 07:37 schrieb Junio C Hamano:\n> René Scharfe <l.s.r@web.de> writes:\n>\n>> GIT_FLUSH=10000000000  yes                     if stdin is not a file\n>\n> Is this because the int is so large that git_parse_signed() notices\n> that it is out of bound (hence \"bogus\")?\n\nYes, atoi() overflows silently and git_parse_maybe_bool() returns -1.\n\nRené\n"},{"id":"469789","messageId":"07b8e696-2736-142e-1937-7e60636de5f4@web.de","threadId":"58432","inReplyTo":"Y7Ury+2n77XBzNl+@coredump.intra.peff.net","subject":"Re: [PATCH 3/5] environ: GIT_FLUSH should be made a usual Boolean","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2023-01-04T16:36:11Z","receivedAt":"2023-01-04T16:36:35Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 04.01.23 um 08:33 schrieb Jeff King:\n> On Tue, Jan 03, 2023 at 06:18:32PM +0100, René Scharfe wrote:\n>\n>>                        before                  with this patch\n>> ---------------------- ----------------------- -----------------------\n>> (unset)                if stdin is not a file  if stdin is not a file\n>> GIT_FLUSH=             no                      no\n>> GIT_FLUSH=0            no                      no\n>> GIT_FLUSH=1\t       yes                     yes\n>> GIT_FLUSH=false        no                      no\n>> GIT_FLUSH=true         no                      yes\n>> GIT_FLUSH=bogus        no                      if stdin is not a file\n>> GIT_FLUSH=10000000000  yes                     if stdin is not a file\n>\n> These last two are unlike most of our other boolean variables, where we\n> complain about bad values:\n>\n>   $ GIT_TEST_ASSUME_DIFFERENT_OWNER=bogus git rev-parse\n>   fatal: bad boolean config value 'bogus' for 'GIT_TEST_ASSUME_DIFFERENT_OWNER'\n>\n>   $ GIT_LITERAL_PATHSPECS=10000000000 git rev-list HEAD -- foo\n>   fatal: bad boolean config value '10000000000' for 'GIT_LITERAL_PATHSPECS'\n>\n>> This implementation ignores invalid values, and doesn't even report\n>> them, as before.  If we want to do that then we need to stop parsing\n>> the variable lazily, in order to report errors before the first\n>> output is written -- in maybe_flush_or_die() it's too late.\n>\n> Why is it too late then? If we're going to do a hard die() anyway (as\n> above), whether it happens after a bit of output or not doesn't seem\n> like that big a deal.\n\nThat's just sloppy for no good reason.  And the output could be quite\nlong and might be shown after the error message.\n\nI can kinda understand that if the user gives us a bogus value we might\nfeel justified to mockingly serve them normally for a moment and only\nthen kick them out for violating our rules.  That's not how I would want\nGit to behave, though -- too human.\n\n> And if we never flush and look at the variable,\n> and the user \"gets away\" with a bogus value, nothing is harmed. That's\n> how existing variables work (e.g., try removing the pathspec from the\n> rev-list invocation above).\n\nI don't mind this part.\n\n> If that behavior is OK, then we could just use git_env_bool() here\n> (though the patch size isn't much different; as you noted, most of the\n> change comes from flipping the variable).\nThe current behavior with atoi() is also to not report any errors.  If\nthat is OK then we can continue to do so.. ;)\n\nBut this leaves the possibility that someone sets GIT_FLUSH=absolutely,\nloses data due to lack of flushing and is dissatisfied with the lack of\nparse errors.\n\nRené\n"},{"id":"469820","messageId":"Y7flkC6BXdvYJxve@coredump.intra.peff.net","threadId":"58432","inReplyTo":"07b8e696-2736-142e-1937-7e60636de5f4@web.de","subject":"Re: [PATCH 3/5] environ: GIT_FLUSH should be made a usual Boolean","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-01-06T09:10:40Z","receivedAt":"2023-01-06T09:10:45Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 04, 2023 at 05:36:11PM +0100, René Scharfe wrote:\n\n> But this leaves the possibility that someone sets GIT_FLUSH=absolutely,\n> loses data due to lack of flushing and is dissatisfied with the lack of\n> parse errors.\n\nI'd worry much more about GIT_FLUSH=ture.\n\nAs you noted, we are not currently diagnosing problems here, so your\npatch is certainly not making anything worse. But maybe it's an\nopportunity for us to improve things. ;)\n\n-Peff\n"}]}