Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-01-13 03:09:57 +0300
committerJunio C Hamano <gitster@pobox.com>2024-01-13 03:09:57 +0300
commitb3049bbb97c9c0d0292bc9239e976cc661961f39 (patch)
tree2bb9881d70c295bcef84ca6fcd64b6bbc34d191e
parent566471105c113e9c9d593a45b604ea8fd03a4484 (diff)
parent556e68032f8248c831e48207e5cb923c9fe0e42c (diff)
Merge branch 'cp/git-flush-is-an-env-bool'
Unlike other environment variables that took the usual true/false/yes/no as well as 0/1, GIT_FLUSH only understood 0/1, which has been corrected. * cp/git-flush-is-an-env-bool: write-or-die: make GIT_FLUSH a Boolean environment variable
-rw-r--r--Documentation/git.txt5
-rw-r--r--write-or-die.c19
2 files changed, 10 insertions, 14 deletions
diff --git a/Documentation/git.txt b/Documentation/git.txt
index bf9e6af695..962887f190 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -724,13 +724,12 @@ 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
+ 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.
diff --git a/write-or-die.c b/write-or-die.c
index 42a2dc73cd..3942152865 100644
--- a/write-or-die.c
+++ b/write-or-die.c
@@ -19,20 +19,17 @@
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) &&
- S_ISREG(st.st_mode))
- skip_stdout_flush = 1;
- else
- skip_stdout_flush = 0;
+ skip_stdout_flush = git_env_bool("GIT_FLUSH", -1);
+ if (skip_stdout_flush < 0) {
+ struct stat st;
+ if (fstat(fileno(stdout), &st))
+ skip_stdout_flush = 0;
+ else
+ skip_stdout_flush = S_ISREG(st.st_mode);
+ }
}
if (skip_stdout_flush && !ferror(f))
return;