Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] credential: let empty credential specs reset helper list

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:08:30

Jeff King [off-list ref] writes:
Sine the credential.helper key is a multi-valued config
s/Sine/Since/;
quoted hunk
diff --git a/credential.c b/credential.c
index 7d6501d..aa99666 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")) {
I wondered why neither the existing code nor the updated one has a
check for !value, but this callback assumes no credential
configuration variable will ever be a boolean and rejects it
upfront, so this code before or after the change is safe.

Not pointing out anything that needs to be changed; demonstrating
that I did read this sufficiently well to say that I have reviewed
it ;-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help