prompt: use git_terminal_prompt

Our custom implementation of git_terminal_prompt has many advantages over regular getpass(), as described in the prior commit. This also lets us implement a PROMPT_ECHO flag for callers who want it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Dec 10, 2011 at 05:41 UTC a50902590e703878e888fd8a33ec5a22d5347481
2 files changed +3 -1
prompt.c
+2 -1
@@ -2,6 +2,7 @@
2 #include "run-command.h"
3 #include "strbuf.h"
4 #include "prompt.h"
5 +#include "compat/terminal.h"
6
7 static char *do_askpass(const char *cmd, const char *prompt)
8 {
@@ -50,7 +51,7 @@ char *git_prompt(const char *prompt, int flags)
51 return do_askpass(askpass, prompt);
52 }
53
53 - r = getpass(prompt);
54 + r = git_terminal_prompt(prompt, flags & PROMPT_ECHO);
55 if (!r)
56 die_errno("could not read '%s'", prompt);
57 return r;
prompt.h
+1
@@ -2,6 +2,7 @@
2 #define PROMPT_H
3
4 #define PROMPT_ASKPASS (1<<0)
5 +#define PROMPT_ECHO (1<<1)
6
7 char *git_prompt(const char *prompt, int flags);
8 char *git_getpass(const char *prompt);