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
This commit is contained in:
@ -18,20 +18,20 @@
|
|||||||
*/
|
*/
|
||||||
void maybe_flush_or_die(FILE *f, const char *desc)
|
void maybe_flush_or_die(FILE *f, const char *desc)
|
||||||
{
|
{
|
||||||
static int skip_stdout_flush = -1;
|
|
||||||
|
|
||||||
if (f == stdout) {
|
if (f == stdout) {
|
||||||
if (skip_stdout_flush < 0) {
|
static int force_flush_stdout = -1;
|
||||||
skip_stdout_flush = git_env_bool("GIT_FLUSH", -1);
|
|
||||||
if (skip_stdout_flush < 0) {
|
if (force_flush_stdout < 0) {
|
||||||
|
force_flush_stdout = git_env_bool("GIT_FLUSH", -1);
|
||||||
|
if (force_flush_stdout < 0) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (fstat(fileno(stdout), &st))
|
if (fstat(fileno(stdout), &st))
|
||||||
skip_stdout_flush = 0;
|
force_flush_stdout = 1;
|
||||||
else
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (fflush(f)) {
|
if (fflush(f)) {
|
||||||
|
Reference in New Issue
Block a user