summaryrefslogtreecommitdiff
path: root/credential.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-12-10 05:31:30 -0500
committerJunio C Hamano <gitster@pobox.com>2011-12-11 23:16:24 -0800
commitd5742425ebfd3060fd181195f3be84cd28c1d06f (patch)
treeed7860e560e9ad0690f73d7375b4b067a13556f4 /credential.c
parent118250728e1aa46c19d4d258950b2ba15cb6d5d2 (diff)
downloadgit-d5742425ebfd3060fd181195f3be84cd28c1d06f.tar.gz
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>
Diffstat (limited to 'credential.c')
-rw-r--r--credential.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/credential.c b/credential.c
index 96be1c22dd..3c17ea1973 100644
--- a/credential.c
+++ b/credential.c
@@ -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;
}