| 170 | } |
| 171 | |
| 172 | static void credential_apply_config(struct repository *r, struct credential *c) |
| 173 | { |
| 174 | char *normalized_url; |
| 175 | struct urlmatch_config config = URLMATCH_CONFIG_INIT; |
| 176 | struct strbuf url = STRBUF_INIT; |
| 177 | |
| 178 | if (!c->host) |
| 179 | die(_("refusing to work with credential missing host field")); |
| 180 | if (!c->protocol) |
| 181 | die(_("refusing to work with credential missing protocol field")); |
| 182 | |
| 183 | if (c->configured) |
| 184 | return; |
| 185 | |
| 186 | config.section = "credential"; |
| 187 | config.key = NULL; |
| 188 | config.collect_fn = credential_config_callback; |
| 189 | config.cascade_fn = NULL; |
| 190 | config.select_fn = select_all; |
| 191 | config.fallback_match_fn = match_partial_url; |
| 192 | config.cb = c; |
| 193 | |
| 194 | credential_format(c, &url); |
| 195 | normalized_url = url_normalize(url.buf, &config.url); |
| 196 | |
| 197 | repo_config(r, urlmatch_config_entry, &config); |
| 198 | string_list_clear(&config.vars, 1); |
| 199 | free(normalized_url); |
| 200 | urlmatch_config_release(&config); |
| 201 | strbuf_release(&url); |
| 202 | |
| 203 | c->configured = 1; |
| 204 | |
| 205 | if (!c->use_http_path && proto_is_http(c->protocol)) { |
| 206 | FREE_AND_NULL(c->path); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | static void credential_describe(struct credential *c, struct strbuf *out) |
| 211 | { |
no test coverage detected