credential: add credential.*.username

Credential helpers can help users avoid having to type their
username and password over and over. However, some users may
not want a helper for their password, or they may be running
a helper which caches for a short time. In this case, it is
convenient to provide the non-secret username portion of
their credential via config.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2011-12-10 05:31:30 -05:00
committed by Junio C Hamano
parent 118250728e
commit d5742425eb
3 changed files with 33 additions and 0 deletions

View File

@ -65,6 +65,10 @@ 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);
}
return 0;
}