credential: let empty credential specs reset helper list
[gitweb.git] / credential.c
index b146ad8481b133892a542691c7e36f5e7974cfdc..aa996669fc40021e0c8cb01fa8021da7064e2781 100644 (file)
@@ -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);
        }
@@ -142,7 +145,7 @@ int credential_read(struct credential *c, FILE *fp)
 {
        struct strbuf line = STRBUF_INIT;
 
-       while (strbuf_getline(&line, fp, '\n') != EOF) {
+       while (strbuf_getline_lf(&line, fp) != EOF) {
                char *key = line.buf;
                char *value = strchr(key, '=');