| 221 | } |
| 222 | |
| 223 | static void credential_format(struct credential *c, struct strbuf *out) |
| 224 | { |
| 225 | if (!c->protocol) |
| 226 | return; |
| 227 | strbuf_addf(out, "%s://", c->protocol); |
| 228 | if (c->username && *c->username) { |
| 229 | strbuf_add_percentencode(out, c->username, STRBUF_ENCODE_SLASH); |
| 230 | strbuf_addch(out, '@'); |
| 231 | } |
| 232 | if (c->host) |
| 233 | strbuf_add_percentencode(out, c->host, |
| 234 | STRBUF_ENCODE_HOST_AND_PORT); |
| 235 | if (c->path) { |
| 236 | strbuf_addch(out, '/'); |
| 237 | strbuf_add_percentencode(out, c->path, 0); |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | static char *credential_ask_one(const char *what, struct credential *c, |
| 242 | int flags) |
no test coverage detected