diff --git a/Documentation/git.txt b/Documentation/git.txt index 2535a30194f978..83fd60f2d11efc 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -724,16 +724,14 @@ for further details. waiting for someone with sufficient permissions to fix it. `GIT_FLUSH`:: -// NEEDSWORK: make it into a usual Boolean environment variable - If this environment variable is set to "1", then commands such + If this Boolean environment variable is set to true, then commands such as 'git blame' (in incremental mode), 'git rev-list', 'git log', - 'git check-attr' and 'git check-ignore' will - force a flush of the output stream after each record have been - flushed. If this - variable is set to "0", the output of these commands will be done - using completely buffered I/O. If this environment variable is - not set, Git will choose buffered or record-oriented flushing - based on whether stdout appears to be redirected to a file or not. + 'git check-attr' and 'git check-ignore' will force a flush of the output + stream after each record have been flushed. If this variable is set to + false, the output of these commands will be done using completely buffered + I/O. If this environment variable is not set, Git will choose buffered or + record-oriented flushing based on whether stdout appears to be redirected + to a file or not. `GIT_TRACE`:: Enables general trace messages, e.g. alias expansion, built-in diff --git a/write-or-die.c b/write-or-die.c index 42a2dc73cd3f18..a6acabd329f7bf 100644 --- a/write-or-die.c +++ b/write-or-die.c @@ -20,15 +20,12 @@ void maybe_flush_or_die(FILE *f, const char *desc) { static int skip_stdout_flush = -1; struct stat st; - char *cp; if (f == stdout) { if (skip_stdout_flush < 0) { - /* NEEDSWORK: make this a normal Boolean */ - cp = getenv("GIT_FLUSH"); - if (cp) - skip_stdout_flush = (atoi(cp) == 0); - else if ((fstat(fileno(stdout), &st) == 0) && + if (!git_env_bool("GIT_FLUSH", -1)) + skip_stdout_flush = 1; + else if (!fstat(fileno(stdout), &st) && S_ISREG(st.st_mode)) skip_stdout_flush = 1; else