diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-02-13 14:31:12 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-02-13 14:31:12 -0800 |
commit | 4abab9e51afd861e49b9428504d3a643248a13f2 (patch) | |
tree | eebbb9da535b1f5f7937417ff6ad3da5ea3a34a6 | |
parent | 9115864cb59473aee9fcb9b0826342444559414d (diff) | |
parent | b40ba17e44cd2614d2f422a0225f6db49ca694a8 (diff) | |
download | git-4abab9e51afd861e49b9428504d3a643248a13f2.tar.gz |
Merge branch 'cp/git-flush-is-an-env-bool'
Recent conversion to allow more than 0/1 in GIT_FLUSH broke the
mechanism by flipping what yes/no means by mistake, which has been
corrected.
* cp/git-flush-is-an-env-bool:
write-or-die: fix the polarity of GIT_FLUSH environment variable
-rw-r--r-- | write-or-die.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/write-or-die.c b/write-or-die.c index 3942152865..01a9a51fa2 100644 --- a/write-or-die.c +++ b/write-or-die.c @@ -18,20 +18,20 @@ */ void maybe_flush_or_die(FILE *f, const char *desc) { - static int skip_stdout_flush = -1; - if (f == stdout) { - if (skip_stdout_flush < 0) { - skip_stdout_flush = git_env_bool("GIT_FLUSH", -1); - if (skip_stdout_flush < 0) { + static int force_flush_stdout = -1; + + if (force_flush_stdout < 0) { + force_flush_stdout = git_env_bool("GIT_FLUSH", -1); + if (force_flush_stdout < 0) { struct stat st; if (fstat(fileno(stdout), &st)) - skip_stdout_flush = 0; + force_flush_stdout = 1; else - skip_stdout_flush = S_ISREG(st.st_mode); + force_flush_stdout = !S_ISREG(st.st_mode); } } - if (skip_stdout_flush && !ferror(f)) + if (!force_flush_stdout && !ferror(f)) return; } if (fflush(f)) { |