environ: GIT_FLUSH should be made a usual Boolean

This uses atoi() and checks if the result is not zero to decide what
to do.  Turning it into the usual Boolean environment variable to
use git_env_bool() would not break those who have been using "set to
0, or set to non-zero, that can be parsed with atoi()" values, but
will match the expectation of those who expected "true" to mean
"yes".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2022-09-15 09:06:57 -07:00
parent 80f0b3f397
commit fd01795beb
2 changed files with 2 additions and 0 deletions

View File

@ -705,6 +705,7 @@ for further details.
waiting for someone with sufficient permissions to fix it. waiting for someone with sufficient permissions to fix it.
`GIT_FLUSH`:: `GIT_FLUSH`::
// NEEDSWORK: make it into a usual Boolean environment variable
If this environment variable is set to "1", then commands such If this environment variable is set to "1", then commands such
as 'git blame' (in incremental mode), 'git rev-list', 'git log', as 'git blame' (in incremental mode), 'git rev-list', 'git log',
'git check-attr' and 'git check-ignore' will 'git check-attr' and 'git check-ignore' will

View File

@ -23,6 +23,7 @@ void maybe_flush_or_die(FILE *f, const char *desc)
if (f == stdout) { if (f == stdout) {
if (skip_stdout_flush < 0) { if (skip_stdout_flush < 0) {
/* NEEDSWORK: make this a normal Boolean */
cp = getenv("GIT_FLUSH"); cp = getenv("GIT_FLUSH");
if (cp) if (cp)
skip_stdout_flush = (atoi(cp) == 0); skip_stdout_flush = (atoi(cp) == 0);