summaryrefslogtreecommitdiff
path: root/credential-store.c
diff options
context:
space:
mode:
authorMatthew DeVore <matvore@google.com>2019-06-27 22:54:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-06-28 15:41:53 (GMT)
commitc2694952e33764818983fa247dcee72113c6ac6a (patch)
treef9566500dd09523b813a4b75072bb5fb52e7a202 /credential-store.c
parentcf9ceb5a12cad9c9153d227a0f497d1b522ce085 (diff)
downloadgit-c2694952e33764818983fa247dcee72113c6ac6a.zip
git-c2694952e33764818983fa247dcee72113c6ac6a.tar.gz
git-c2694952e33764818983fa247dcee72113c6ac6a.tar.bz2
strbuf: give URL-encoding API a char predicate fn
Allow callers to specify exactly what characters need to be URL-encoded and which do not. This new API will be taken advantage of in a patch later in this set. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Matthew DeVore <matvore@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'credential-store.c')
-rw-r--r--credential-store.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/credential-store.c b/credential-store.c
index ac29542..c010497 100644
--- a/credential-store.c
+++ b/credential-store.c
@@ -72,15 +72,16 @@ static void store_credential_file(const char *fn, struct credential *c)
struct strbuf buf = STRBUF_INIT;
strbuf_addf(&buf, "%s://", c->protocol);
- strbuf_addstr_urlencode(&buf, c->username, 1);
+ strbuf_addstr_urlencode(&buf, c->username, is_rfc3986_unreserved);
strbuf_addch(&buf, ':');
- strbuf_addstr_urlencode(&buf, c->password, 1);
+ strbuf_addstr_urlencode(&buf, c->password, is_rfc3986_unreserved);
strbuf_addch(&buf, '@');
if (c->host)
- strbuf_addstr_urlencode(&buf, c->host, 1);
+ strbuf_addstr_urlencode(&buf, c->host, is_rfc3986_unreserved);
if (c->path) {
strbuf_addch(&buf, '/');
- strbuf_addstr_urlencode(&buf, c->path, 0);
+ strbuf_addstr_urlencode(&buf, c->path,
+ is_rfc3986_reserved_or_unreserved);
}
rewrite_credential_file(fn, c, &buf);