Thread (41 messages) 41 messages, 6 authors, 2016-06-15
DORMANTno replies

[PATCH 4/6] prompt: add PROMPT_ECHO flag

From: Jeff King <hidden>
Date: 2016-06-15 22:52:32
Subsystem: the rest · Maintainer: Linus Torvalds

This will use getpass_echo when set.

Signed-off-by: Jeff King <redacted>
---
 prompt.c |    5 ++++-
 prompt.h |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/prompt.c b/prompt.c
index 7c8f9aa..c46227f 100644
--- a/prompt.c
+++ b/prompt.c
@@ -2,6 +2,7 @@
 #include "run-command.h"
 #include "strbuf.h"
 #include "prompt.h"
+#include "compat/getpass.h"
 
 static char *do_askpass(const char *cmd, const char *prompt, const char *name)
 {
@@ -48,7 +49,9 @@
 			return do_askpass(askpass, prompt, name);
 	}
 
-	return getpass(prompt);
+	return flags & PROMPT_ECHO ?
+		getpass_echo(prompt) :
+		getpass(prompt);
 }
 
 char *git_getpass(const char *prompt)
diff --git a/prompt.h b/prompt.h
index 18868c2..7201cae 100644
--- a/prompt.h
+++ b/prompt.h
@@ -2,6 +2,7 @@
 #define PROMPT_H
 
 #define PROMPT_ASKPASS (1<<0)
+#define PROMPT_ECHO    (1<<1)
 
 char *git_prompt(const char *prompt, const char *name, int flags);
 char *git_getpass(const char *prompt);
-- 
1.7.7.4.7.g24824
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help