Skip to content

Commit 7687ca5

Browse files
committed
Merge branch 'cp/git-flush-is-an-env-bool' into maint-2.43
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
2 parents bd10c45 + b40ba17 commit 7687ca5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

write-or-die.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@
1818
*/
1919
void maybe_flush_or_die(FILE *f, const char *desc)
2020
{
21-
static int skip_stdout_flush = -1;
22-
2321
if (f == stdout) {
24-
if (skip_stdout_flush < 0) {
25-
skip_stdout_flush = git_env_bool("GIT_FLUSH", -1);
26-
if (skip_stdout_flush < 0) {
22+
static int force_flush_stdout = -1;
23+
24+
if (force_flush_stdout < 0) {
25+
force_flush_stdout = git_env_bool("GIT_FLUSH", -1);
26+
if (force_flush_stdout < 0) {
2727
struct stat st;
2828
if (fstat(fileno(stdout), &st))
29-
skip_stdout_flush = 0;
29+
force_flush_stdout = 1;
3030
else
31-
skip_stdout_flush = S_ISREG(st.st_mode);
31+
force_flush_stdout = !S_ISREG(st.st_mode);
3232
}
3333
}
34-
if (skip_stdout_flush && !ferror(f))
34+
if (!force_flush_stdout && !ferror(f))
3535
return;
3636
}
3737
if (fflush(f)) {

0 commit comments

Comments
 (0)