Skip to content

Commit fb3b2e6

Browse files
10ne1gitster
authored andcommitted
strbuf: bring back is_rfc3986_unreserved
is_rfc3986_unreserved() was moved to credential-store.c and was made static by f898543 (credential-store: move related functions to credential-store file, 2023-06-06) under a correct assumption, at the time, that it was the only place using it. However now we need it to apply URL-encoding to submodule names when constructing gitdir paths, to avoid conflicts, so bring it back. Signed-off-by: Adrian Ratiu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3f5aab3 commit fb3b2e6

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

builtin/credential-store.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ static void rewrite_credential_file(const char *fn, struct credential *c,
7676
die_errno("unable to write credential store");
7777
}
7878

79-
static int is_rfc3986_unreserved(char ch)
80-
{
81-
return isalnum(ch) ||
82-
ch == '-' || ch == '_' || ch == '.' || ch == '~';
83-
}
84-
8579
static int is_rfc3986_reserved_or_unreserved(char ch)
8680
{
8781
if (is_rfc3986_unreserved(ch))

strbuf.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,12 @@ void strbuf_addstr_xml_quoted(struct strbuf *buf, const char *s)
817817
}
818818
}
819819

820+
int is_rfc3986_unreserved(char ch)
821+
{
822+
return isalnum(ch) ||
823+
ch == '-' || ch == '_' || ch == '.' || ch == '~';
824+
}
825+
820826
static void strbuf_add_urlencode(struct strbuf *sb, const char *s, size_t len,
821827
char_predicate allow_unencoded_fn)
822828
{

strbuf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,8 @@ static inline void strbuf_complete_line(struct strbuf *sb)
640640

641641
typedef int (*char_predicate)(char ch);
642642

643+
int is_rfc3986_unreserved(char ch);
644+
643645
void strbuf_addstr_urlencode(struct strbuf *sb, const char *name,
644646
char_predicate allow_unencoded_fn);
645647

0 commit comments

Comments
 (0)