Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
prompt: use git_terminal_prompt
author
Jeff King
<peff@peff.net>
Sat, 10 Dec 2011 10:41:08 +0000
(
05:41
-0500)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 13 Dec 2011 00:09:38 +0000
(16:09 -0800)
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>
prompt.c
patch
|
blob
|
history
prompt.h
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
21aeafc
)
diff --git
a/prompt.c
b/prompt.c
index 20026444c018d0358d6dfbeecb23df3f021bc4ce..72ab9de2f94be30eef9e41ced97580f7de48e0fc 100644
(file)
--- a/
prompt.c
+++ b/
prompt.c
@@
-2,6
+2,7
@@
#include "run-command.h"
#include "strbuf.h"
#include "prompt.h"
#include "run-command.h"
#include "strbuf.h"
#include "prompt.h"
+#include "compat/terminal.h"
static char *do_askpass(const char *cmd, const char *prompt)
{
static char *do_askpass(const char *cmd, const char *prompt)
{
@@
-50,7
+51,7
@@
char *git_prompt(const char *prompt, int flags)
return do_askpass(askpass, prompt);
}
return do_askpass(askpass, prompt);
}
- r = g
etpass(prompt
);
+ r = g
it_terminal_prompt(prompt, flags & PROMPT_ECHO
);
if (!r)
die_errno("could not read '%s'", prompt);
return r;
if (!r)
die_errno("could not read '%s'", prompt);
return r;
diff --git
a/prompt.h
b/prompt.h
index 9ab85a78a24db86283f22168db61e51d5ef87546..04f321a781d37af780b906c2a4564c08eea830c8 100644
(file)
--- a/
prompt.h
+++ b/
prompt.h
@@
-2,6
+2,7
@@
#define PROMPT_H
#define PROMPT_ASKPASS (1<<0)
#define PROMPT_H
#define PROMPT_ASKPASS (1<<0)
+#define PROMPT_ECHO (1<<1)
char *git_prompt(const char *prompt, int flags);
char *git_getpass(const char *prompt);
char *git_prompt(const char *prompt, int flags);
char *git_getpass(const char *prompt);