summaryrefslogtreecommitdiff
path: root/credential.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2023-05-01 15:53:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2023-05-01 16:27:00 (GMT)
commit16b305cd2ba1747bcc6d160665eccdbbf7f2ea10 (patch)
tree1146d1bd533ef0ae5bb0114449534ef93ec42fbb /credential.c
parent48d89b51b3bb8a60580c36731b96a7206ce1e5b9 (diff)
downloadgit-16b305cd2ba1747bcc6d160665eccdbbf7f2ea10.zip
git-16b305cd2ba1747bcc6d160665eccdbbf7f2ea10.tar.gz
git-16b305cd2ba1747bcc6d160665eccdbbf7f2ea10.tar.bz2
credential.c: store "wwwauth[]" values in `credential_read()`
Teach git-credential to read "wwwauth[]" value(s) when parsing the output of a credential helper. These extra headers are not needed for Git's own HTTP support to use the feature internally, but the feature would not be available for a scripted caller (say, git-remote-mediawiki providing the header in the same way). As a bonus, this also makes it easier to use wwwauth[] in synthetic credential inputs in our test suite. Co-authored-by: Jeff King <peff@peff.net> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'credential.c')
-rw-r--r--credential.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/credential.c b/credential.c
index e6417bf..96fc0da 100644
--- a/credential.c
+++ b/credential.c
@@ -238,6 +238,8 @@ int credential_read(struct credential *c, FILE *fp)
} else if (!strcmp(key, "path")) {
free(c->path);
c->path = xstrdup(value);
+ } else if (!strcmp(key, "wwwauth[]")) {
+ strvec_push(&c->wwwauth_headers, value);
} else if (!strcmp(key, "password_expiry_utc")) {
errno = 0;
c->password_expiry_utc = parse_timestamp(value, NULL, 10);