From: Matheus Afonso Martins Moreira via GitGitGadget Date: Sun, 28 Apr 2024 22:30:53 GMT Subject: [PATCH 05/13] url-parse: enumerate possible URL components Message-ID: <0bf83ee1228130df6069206190b97f1d0329794e.1714343461.git.gitgitgadget@gmail.com> In-Reply-To: From: Matheus Afonso Martins Moreira Create an enumeration containing all possible git URL components which may be selected by the user. The URL_NONE component is used when the user did not request the parsing of any component. In this case, the command will return successfully if the URL parses. Signed-off-by: Matheus Afonso Martins Moreira --- builtin/url-parse.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/builtin/url-parse.c b/builtin/url-parse.c index 933e63aaa0a..d250338422e 100644 --- a/builtin/url-parse.c +++ b/builtin/url-parse.c @@ -13,6 +13,16 @@ #include "gettext.h" #include "urlmatch.h" +enum url_component { + URL_NONE = 0, + URL_PROTOCOL, + URL_USER, + URL_PASSWORD, + URL_HOST, + URL_PORT, + URL_PATH, +}; + static void parse_or_die(const char *url, struct url_info *info) { if (url_parse(url, info)) { -- gitgitgadget