Skip to content

Commit 0ae1062

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge branch 'fflush-in-git-clean'
After writing to `stdout` and before reading from `stdin`, it is a good idea to flush the former. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents c94dc35 + 10c2314 commit 0ae1062

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

builtin/clean.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ static int *list_and_choose(struct menu_opts *opts, struct menu_stuff *stuff)
580580
clean_get_color(CLEAN_COLOR_RESET));
581581
}
582582

583+
fflush(stdout);
583584
if (strbuf_getline_lf(&choice, stdin) != EOF) {
584585
strbuf_trim(&choice);
585586
} else {
@@ -662,6 +663,7 @@ static int filter_by_patterns_cmd(void)
662663
clean_print_color(CLEAN_COLOR_PROMPT);
663664
printf(_("Input ignore patterns>> "));
664665
clean_print_color(CLEAN_COLOR_RESET);
666+
fflush(stdout);
665667
if (strbuf_getline_lf(&confirm, stdin) != EOF)
666668
strbuf_trim(&confirm);
667669
else
@@ -760,6 +762,7 @@ static int ask_each_cmd(void)
760762
qname = quote_path_relative(item->string, NULL, &buf);
761763
/* TRANSLATORS: Make sure to keep [y/N] as is */
762764
printf(_("Remove %s [y/N]? "), qname);
765+
fflush(stdout);
763766
if (strbuf_getline_lf(&confirm, stdin) != EOF) {
764767
strbuf_trim(&confirm);
765768
} else {

0 commit comments

Comments
 (0)