[PATCH] clean: flush after each line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Orgad Shaneh <orgads@xxxxxxxxx>

Some platforms don't automatically flush after \n, and this causes delay
of the output, and also sometimes incomplete file names appear until the
next chunk is flushed.

Reported here: https://github.com/git-for-windows/git/issues/3706

Signed-off-by: Orgad Shaneh <orgads@xxxxxxxxx>
---
    clean: flush after each line

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1447%2Forgads%2Fclean-flush-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1447/orgads/clean-flush-v1
Pull-Request: https://github.com/git/git/pull/1447

 builtin/clean.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/builtin/clean.c b/builtin/clean.c
index b2701a28158..f3de8170f9a 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -270,8 +270,10 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
 
 	if (!*dir_gone && !quiet) {
 		int i;
-		for (i = 0; i < dels.nr; i++)
+		for (i = 0; i < dels.nr; i++) {
 			printf(dry_run ?  _(msg_would_remove) : _(msg_remove), dels.items[i].string);
+			fflush(stdout);
+		}
 	}
 out:
 	strbuf_release(&realpath);
@@ -544,6 +546,7 @@ static int parse_choice(struct menu_stuff *menu_stuff,
 			clean_print_color(CLEAN_COLOR_ERROR);
 			printf(_("Huh (%s)?\n"), (*ptr)->buf);
 			clean_print_color(CLEAN_COLOR_RESET);
+			fflush(stdout);
 			continue;
 		}
 

base-commit: 2fc9e9ca3c7505bc60069f11e7ef09b1aeeee473
-- 
gitgitgadget



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux