git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug report: Incorrect GIT_FLUSH behavior in 2.43.1 (regression and breaking)

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 12, 2024, 17:11 UTC
Message-ID
<xmqq8r3p7glr.fsf@gitster.g>
In-Reply-To
<CABn0oJvg3M_kBW-u=j3QhKnO=6QOzk-YFTgonYw_UvFS1NTX4g@mail.gmail.com>
Xiaoguang WANG <wxiaoguang@gmail.com> writes:
> If GIT_FLUSH=true, it should mean to "do the flush". But that commit
> made skip_stdout_flush=true when GIT_FLUSH=true.

Thanks for reporting. I am surprised that this flipping of polarity slipped through.

> And by the way, only accepting GIT_FLUSH=true is quite breaking, it
> drops the compatibility of GIT_FLUSH=1

I do not think so. If the polarity is corrected, git_env_bool() would say "that's affirmative" when any one of the "1", "true", "yes", "on", etc. is given. If you have been passing "1", you should get the "always flush" behaviour.

Perhaps something like this would fix it?
 write-or-die.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git c/write-or-die.c w/write-or-die.c
index 3942152865..3ecb9e2af5 100644
--- c/write-or-die.c
+++ w/write-or-die.c
@@ -22,8 +22,11 @@ void maybe_flush_or_die(FILE *f, const char *desc)
 
 	if (f == stdout) {
 		if (skip_stdout_flush < 0) {
-			skip_stdout_flush = git_env_bool("GIT_FLUSH", -1);
-			if (skip_stdout_flush < 0) {
+			int flush_setting = git_env_bool("GIT_FLUSH", -1);
+
+			if (0 <= flush_setting)
+				skip_stdout_flush = !flush_setting;
+			else {
 				struct stat st;
 				if (fstat(fileno(stdout), &st))
 					skip_stdout_flush = 0;
Previous: Xiaoguang WANGNext: Xiaoguang WANG
Message 2 of 7 in “Bug report: Incorrect GIT_FLUSH behavior in 2.43.1 (regression and breaking)”
  1. Xiaoguang WANGFeb 12, 2024
  2. Junio C HamanoFeb 12, 2024
  3. Xiaoguang WANGFeb 12, 2024
  4. Phillip WoodFeb 13, 2024
  5. Junio C HamanoFeb 13, 2024
  6. Junio C HamanoFeb 13, 2024
  7. Phillip WoodFeb 14, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.