diff options
| author | Ryan Wilcox <rwilcox@wilcoxd.com> | 2012-03-01 08:31:50 -0500 |
|---|---|---|
| committer | Ryan Wilcox <rwilcox@wilcoxd.com> | 2012-03-01 08:31:50 -0500 |
| commit | 7a5449662972769b6b09540463d8b6378664393a (patch) | |
| tree | 551170803172ceb3a2aed0b30a46e4fc5d70a4d8 /src | |
| parent | 253d6df5fd899ca9273b73a919ec5f19f0ff2df4 (diff) | |
| download | libgit2-7a5449662972769b6b09540463d8b6378664393a.tar.gz | |
introduced new function: git_remote_supported_url() <-- returns true if this version of libgit2 supports the correct transport mechanism for a URL or path
Diffstat (limited to 'src')
| -rw-r--r-- | src/transport.c | 6 | ||||
| -rw-r--r-- | src/transport.h | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/transport.c b/src/transport.c index e6ba0758b..cd1fd88b5 100644 --- a/src/transport.c +++ b/src/transport.c @@ -88,3 +88,9 @@ int git_remote_valid_url(const char *url) return transport_find_fn(url) != NULL; } +int git_remote_supported_url(const char* url) +{ + git_transport_cb transport_fn = transport_find_fn(url); + + return ((transport_fn != NULL) && (transport_fn != &git_transport_dummy)); +} diff --git a/src/transport.h b/src/transport.h index 4c123571d..812099e7f 100644 --- a/src/transport.h +++ b/src/transport.h @@ -102,8 +102,20 @@ int git_transport_local(struct git_transport **transport); int git_transport_git(struct git_transport **transport); int git_transport_http(struct git_transport **transport); int git_transport_dummy(struct git_transport **transport); + +/** + Returns true if the passed URL is valid (a URL with a Git supported scheme, + or pointing to an existing path) +*/ int git_transport_valid_url(const char *url); +/** + Returns true if the passed URL is supported by this version of libgit2. + (or, more technically, the transport method inferred by libgit is supported + by this version of libgit2). +*/ +int git_remote_supported_url(const char* url); + typedef struct git_transport git_transport; typedef int (*git_transport_cb)(git_transport **transport); |
