aboutsummaryrefslogtreecommitdiffstats
path: root/add-interactive.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 /add-interactive.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 'add-interactive.c')
-rw-r--r--add-interactive.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/add-interactive.c b/add-interactive.c
index 4a9bf85cac..29cd2fe020 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -9,6 +9,7 @@
#include "lockfile.h"
#include "dir.h"
#include "run-command.h"
+#include "prompt.h"
static void init_color(struct repository *r, struct add_i_state *s,
const char *slot_name, char *dst,
@@ -289,13 +290,12 @@ static ssize_t list_and_choose(struct add_i_state *s,
fputs(singleton ? "> " : ">> ", stdout);
fflush(stdout);
- if (strbuf_getline(&input, stdin) == EOF) {
+ if (git_read_line_interactively(&input) == EOF) {
putchar('\n');
if (immediate)
res = LIST_AND_CHOOSE_QUIT;
break;
}
- strbuf_trim(&input);
if (!input.len)
break;