summaryrefslogtreecommitdiff
path: root/credential.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 /credential.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 'credential.c')
-rw-r--r--credential.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/credential.c b/credential.c
index 1886ea50b3..b146ad8481 100644
--- a/credential.c
+++ b/credential.c
@@ -173,6 +173,8 @@ int credential_read(struct credential *c, FILE *fp)
c->path = xstrdup(value);
} else if (!strcmp(key, "url")) {
credential_from_url(c, value);
+ } else if (!strcmp(key, "quit")) {
+ c->quit = !!git_config_bool("quit", value);
}
/*
* Ignore other lines; we don't know what they mean, but
@@ -274,6 +276,9 @@ void credential_fill(struct credential *c)
credential_do(c, c->helpers.items[i].string, "get");
if (c->username && c->password)
return;
+ if (c->quit)
+ die("credential helper '%s' told us to quit",
+ c->helpers.items[i].string);
}
credential_getpass(c);