MCPcopy Index your code
hub / github.com/git/git / credential_getpass

Function credential_getpass

credential.c:264–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264static 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
296int credential_has_capability(const struct credential_capability *capa,
297 enum credential_op_type op_type)

Callers 1

credential_fillFunction · 0.85

Calls 3

repo_config_get_stringFunction · 0.85
credential_ask_oneFunction · 0.85

Tested by

no test coverage detected