Jeff King <peff@xxxxxxxx> writes: > This (and the patch) make sense to me. It might be worth factoring out a > "read input from user" function and putting the flush there, but with > only three affected call sites, I'm OK with it either way. > >> This is yet another patch that was funneled through a Git for Windows >> PR. It has served us well for almost five years now, and it is beyond >> time that it find its final home in core Git. > > Agreed. I guess it didn't affect people on other platforms much because > stdout to a terminal is generally line-buffered on POSIX systems. But > it's better not to rely on that, plus it could create confusion if > somebody tried to manipulate the interactive operation through a pipe > (e.g., driving it from a GUI or something). Hmph, I thought it was more common to do prompts etc. on the standard error stream, which tends to make the buffering of the output less of a problem, but apparently these prompts are given to the standard output. I am also OK to sprinkle fflush(stdout) but in the longer term, it would probably be a good idea to introduce a helper to "prompt then grab input" or "read user input" (if the former, we'd be able to bring consistency into "which between the standard output or the standard error does a prompt come?", and if the latter we'd do fflush(NULL) before reading), especially if there are many git subcommands that go interactive. Thanks.