summaryrefslogtreecommitdiff
path: root/credential.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-04-03 10:29:24 -0700
committerJunio C Hamano <gitster@pobox.com>2016-04-03 10:29:24 -0700
commit1b68962b29e39b0455e0f15d6b95edc65accb98c (patch)
treeb30eacde916593628825ddedac19074b4665f52f /credential.c
parente13de0bdd80ca1f9e18c1d00e8d75fc6a3bc0824 (diff)
parent24321375cda79f141be72d1a842e930df6f41725 (diff)
downloadgit-1b68962b29e39b0455e0f15d6b95edc65accb98c.tar.gz
Merge branch 'jk/credential-clear-config'
The credential.helper configuration variable is cumulative and there is no good way to override it from the command line. As a special case, giving an empty string as its value now serves as the signal to clear the values specified in various files. * jk/credential-clear-config: credential: let empty credential specs reset helper list
Diffstat (limited to 'credential.c')
-rw-r--r--credential.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/credential.c b/credential.c
index 7d6501d190..aa996669fc 100644
--- a/credential.c
+++ b/credential.c
@@ -63,9 +63,12 @@ static int credential_config_callback(const char *var, const char *value,
key = dot + 1;
}
- if (!strcmp(key, "helper"))
- string_list_append(&c->helpers, value);
- else if (!strcmp(key, "username")) {
+ if (!strcmp(key, "helper")) {
+ if (*value)
+ string_list_append(&c->helpers, value);
+ else
+ string_list_clear(&c->helpers, 0);
+ } else if (!strcmp(key, "username")) {
if (!c->username)
c->username = xstrdup(value);
}