X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=credential.c;h=a17eafea582638e3d77f2e37b9d82fe5069798c0;hb=35a71f1402b40b580d985a9d7e5fb1c9ec4d0232;hp=96be1c22dd4b6188aef9c89de51ffe6ac08a0331;hpb=118250728e1aa46c19d4d258950b2ba15cb6d5d2;p=git.git diff --git a/credential.c b/credential.c index 96be1c22d..a17eafea5 100644 --- a/credential.c +++ b/credential.c @@ -65,16 +65,34 @@ static int credential_config_callback(const char *var, const char *value, if (!strcmp(key, "helper")) string_list_append(&c->helpers, value); + else if (!strcmp(key, "username")) { + if (!c->username) + c->username = xstrdup(value); + } + else if (!strcmp(key, "usehttppath")) + c->use_http_path = git_config_bool(var, value); return 0; } +static int proto_is_http(const char *s) +{ + if (!s) + return 0; + return !strcmp(s, "https") || !strcmp(s, "http"); +} + static void credential_apply_config(struct credential *c) { if (c->configured) return; git_config(credential_config_callback, c); c->configured = 1; + + if (!c->use_http_path && proto_is_http(c->protocol)) { + free(c->path); + c->path = NULL; + } } static void credential_describe(struct credential *c, struct strbuf *out)