* Check whether a transport is implemented by git-remote-curl. * * If it is, returns 1 and writes the URL that would be passed to * git-remote-curl to the "out" parameter. * * Otherwise, returns 0 and leaves "out" untouched. * * Examples: * http::https://example.com/repo.git -> 1, https://example.com/repo.git * https://example.com/repo.git -> 1, https://example.com/repo.git * git:/
| 286 | * required a submodule URL to be passed to git-remote-curl. |
| 287 | */ |
| 288 | static int url_to_curl_url(const char *url, const char **out) |
| 289 | { |
| 290 | /* |
| 291 | * We don't need to check for case-aliases, "http.exe", and so |
| 292 | * on because in the default configuration, is_transport_allowed |
| 293 | * prevents URLs with those schemes from being cloned |
| 294 | * automatically. |
| 295 | */ |
| 296 | if (skip_prefix(url, "http::", out) || |
| 297 | skip_prefix(url, "https::", out) || |
| 298 | skip_prefix(url, "ftp::", out) || |
| 299 | skip_prefix(url, "ftps::", out)) |
| 300 | return 1; |
| 301 | if (starts_with(url, "http://") || |
| 302 | starts_with(url, "https://") || |
| 303 | starts_with(url, "ftp://") || |
| 304 | starts_with(url, "ftps://")) { |
| 305 | *out = url; |
| 306 | return 1; |
| 307 | } |
| 308 | return 0; |
| 309 | } |
| 310 | |
| 311 | int check_submodule_url(const char *url) |
| 312 | { |
no test coverage detected