| 262 | } |
| 263 | |
| 264 | static int credential_getpass(struct repository *r, struct credential *c) |
| 265 | { |
| 266 | int interactive; |
| 267 | char *value; |
| 268 | if (!repo_config_get_maybe_bool(r, "credential.interactive", &interactive) && |
| 269 | !interactive) { |
| 270 | trace2_data_intmax("credential", r, |
| 271 | "interactive/skipped", 1); |
| 272 | return -1; |
| 273 | } |
| 274 | if (!repo_config_get_string(r, "credential.interactive", &value)) { |
| 275 | int same = !strcmp(value, "never"); |
| 276 | free(value); |
| 277 | if (same) { |
| 278 | trace2_data_intmax("credential", r, |
| 279 | "interactive/skipped", 1); |
| 280 | return -1; |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | trace2_region_enter("credential", "interactive", r); |
| 285 | if (!c->username) |
| 286 | c->username = credential_ask_one("Username", c, |
| 287 | PROMPT_ASKPASS|PROMPT_ECHO); |
| 288 | if (!c->password) |
| 289 | c->password = credential_ask_one("Password", c, |
| 290 | PROMPT_ASKPASS); |
| 291 | trace2_region_leave("credential", "interactive", r); |
| 292 | |
| 293 | return 0; |
| 294 | } |
| 295 | |
| 296 | int credential_has_capability(const struct credential_capability *capa, |
| 297 | enum credential_op_type op_type) |
no test coverage detected