Make git_remote_supported_url() public and shorten error string
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
diff --git a/include/git2/remote.h b/include/git2/remote.h
index e6537ec..1830c72 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -198,6 +198,14 @@ GIT_EXTERN(int) git_remote_update_tips(git_remote *remote);
GIT_EXTERN(int) git_remote_valid_url(const char *url);
/**
+ * Return whether the passed URL is supported by this version of the library.
+ *
+ * @param url the url to check
+ * @return 1 if the url is supported, 0 otherwise
+*/
+GIT_EXTERN(int) git_remote_supported_url(const char* url);
+
+/**
* Get a list of the configured remotes for a repo
*
* The string array must be freed by the user.
diff --git a/src/transport.c b/src/transport.c
index cd1fd88..4c486e2 100644
--- a/src/transport.c
+++ b/src/transport.c
@@ -10,7 +10,6 @@
#include "git2/net.h"
#include "transport.h"
#include "path.h"
-#include <regex.h>
static struct {
char *prefix;
@@ -67,7 +66,7 @@ int git_transport_new(git_transport **out, const char *url)
fn = transport_find_fn(url);
if (fn == NULL)
- return git__throw(GIT_EINVALIDARGS, "No supported transport mechanism found for URL or path. Either libgit2 has not implemented this transport protocol, or it can not find the specified path.");
+ return git__throw(GIT_EINVALIDARGS, "Unsupported URL or non-existent path");
error = fn(&transport);
if (error < GIT_SUCCESS)
diff --git a/src/transport.h b/src/transport.h
index 812099e..63dd7da 100644
--- a/src/transport.h
+++ b/src/transport.h
@@ -109,13 +109,6 @@ int git_transport_dummy(struct git_transport **transport);
*/
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);