aboutsummaryrefslogtreecommitdiffstats
path: root/prompt.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-04-22 13:42:58 -0700
committerJunio C Hamano <gitster@pobox.com>2020-04-22 13:42:58 -0700
commit33feaca6bfec2b80bcb915cfb477dcb3b14c7ef0 (patch)
treec909ff4dc330308aec6e84fc77f51c8412ab1469 /prompt.c
parent9af3a7cb4d6d2aa7807b1f0d0e5b5b8605177413 (diff)
parent1f09aed8346f11c9fd236940b6e500388c394af2 (diff)
downloadgit-33feaca6bfec2b80bcb915cfb477dcb3b14c7ef0.tar.gz
Merge branch 'js/flush-prompt-before-interative-input'
The interactive input from various codepaths are consolidated and any prompt possibly issued earlier are fflush()ed before we read. * js/flush-prompt-before-interative-input: interactive: explicitly `fflush` stdout before expecting input interactive: refactor code asking the user for interactive input
Diffstat (limited to 'prompt.c')
-rw-r--r--prompt.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/prompt.c b/prompt.c
index 6d5885d009..5ded21a017 100644
--- a/prompt.c
+++ b/prompt.c
@@ -74,3 +74,15 @@ char *git_prompt(const char *prompt, int flags)
}
return r;
}
+
+int git_read_line_interactively(struct strbuf *line)
+{
+ int ret;
+
+ fflush(stdout);
+ ret = strbuf_getline_lf(line, stdin);
+ if (ret != EOF)
+ strbuf_trim_trailing_newline(line);
+
+ return ret;
+}