From 2d6dc182b8fa171a6b283ce6e8e75a35e13ea67a Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Sun, 24 Jun 2012 13:40:00 +0200 Subject: git credential fill: output the whole 'struct credential' Instead of outputing only the username and password, print all the attributes, even those that already appeared in the input. This is closer to what the C API does, and allows one to take the exact output of "git credential fill" as input to "git credential approve" or "git credential reject". Signed-off-by: Junio C Hamano --- credential.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'credential.c') diff --git a/credential.c b/credential.c index 62d1c56819..2c400073fa 100644 --- a/credential.c +++ b/credential.c @@ -191,7 +191,7 @@ static void credential_write_item(FILE *fp, const char *key, const char *value) fprintf(fp, "%s=%s\n", key, value); } -static void credential_write(const struct credential *c, FILE *fp) +void credential_write(const struct credential *c, FILE *fp) { credential_write_item(fp, "protocol", c->protocol); credential_write_item(fp, "host", c->host); -- cgit v1.2.1 From 9c183a70722804114ac1dc54d17fe791ac1a452c Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 18 Jul 2012 08:06:26 -0400 Subject: credential: convert "url" attribute into its parsed subparts The git-credential command requires that you feed it a broken-down credential, which means that the client needs to parse a URL itself. Since we have our own URL-parsing routines, we can easily allow the caller to just give us the URL as-is, saving them some code. Signed-off-by: Jeff King Acked-by: Matthieu Moy Signed-off-by: Junio C Hamano --- credential.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'credential.c') diff --git a/credential.c b/credential.c index 2c400073fa..e54753c75d 100644 --- a/credential.c +++ b/credential.c @@ -172,6 +172,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, "url")) { + credential_from_url(c, value); } /* * Ignore other lines; we don't know what they mean, but -- cgit v1.2.1