From 24321375cda79f141be72d1a842e930df6f41725 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 26 Feb 2016 05:51:35 -0500 Subject: credential: let empty credential specs reset helper list Sine the credential.helper key is a multi-valued config list, there's no way to "unset" a helper once it's been set. So if your system /etc/gitconfig sets one, you can never avoid running it, but only add your own helpers on top. Since an empty value for credential.helper is nonsensical (it would just try to run "git-credential-"), we can assume nobody is using it. Let's define it to reset the helper list, letting you override lower-priority instances which have come before. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- credential.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'credential.c') 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); } -- cgit v1.2.3