summaryrefslogtreecommitdiff
path: root/prompt.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-12-22 12:27:19 -0800
committerJunio C Hamano <gitster@pobox.com>2014-12-22 12:27:20 -0800
commit86362f7205a31188846de0aed94620c1f0776931 (patch)
tree8ad1f4a040a08d15d1514f26b0f8235a3a6fcf35 /prompt.c
parent2f17ecbd8d58c79e76767da82cf824840dfd367f (diff)
parente652c0eb5d772076f92245c7e076bf6aaf6af223 (diff)
downloadgit-86362f7205a31188846de0aed94620c1f0776931.tar.gz
Merge branch 'jk/credential-quit'
Credential helpers are asked in turn until one of them give positive response, which is cumbersome to turn off when you need to run Git in an automated setting. The credential helper interface learned to allow a helper to say "stop, don't ask other helpers." Also GIT_TERMINAL_PROMPT environment can be set to false to disable our built-in prompt mechanism for passwords. * jk/credential-quit: prompt: respect GIT_TERMINAL_PROMPT to disable terminal prompts credential: let helpers tell us to quit
Diffstat (limited to 'prompt.c')
-rw-r--r--prompt.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/prompt.c b/prompt.c
index e5b4938efc..8181eebbfc 100644
--- a/prompt.c
+++ b/prompt.c
@@ -57,11 +57,19 @@ char *git_prompt(const char *prompt, int flags)
r = do_askpass(askpass, prompt);
}
- if (!r)
- r = git_terminal_prompt(prompt, flags & PROMPT_ECHO);
if (!r) {
- /* prompts already contain ": " at the end */
- die("could not read %s%s", prompt, strerror(errno));
+ const char *err;
+
+ if (git_env_bool("GIT_TERMINAL_PROMPT", 1)) {
+ r = git_terminal_prompt(prompt, flags & PROMPT_ECHO);
+ err = strerror(errno);
+ } else {
+ err = "terminal prompts disabled";
+ }
+ if (!r) {
+ /* prompts already contain ": " at the end */
+ die("could not read %s%s", prompt, err);
+ }
}
return r;
}