Provide a public entry method to determine whether a URI protocol is supported
This commit is contained in:
parent
d8ec8527a6
commit
046d1a2ef6
|
@ -318,6 +318,38 @@ private static boolean doesNotExist(final RemoteConfig cfg) {
|
||||||
return cfg.getURIs().isEmpty() && cfg.getPushURIs().isEmpty();
|
return cfg.getURIs().isEmpty() && cfg.getPushURIs().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the transport can handle the given URIish.
|
||||||
|
*
|
||||||
|
* @param remote
|
||||||
|
* location of the remote repository.
|
||||||
|
* @return true if the protocol is supported.
|
||||||
|
*/
|
||||||
|
public static boolean canHandleProtocol(final URIish remote) {
|
||||||
|
if (TransportGitSsh.canHandle(remote))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
else if (TransportHttp.canHandle(remote))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
else if (TransportSftp.canHandle(remote))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
else if (TransportGitAnon.canHandle(remote))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
else if (TransportAmazonS3.canHandle(remote))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
else if (TransportBundleFile.canHandle(remote))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
else if (TransportLocal.canHandle(remote))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a new transport instance to connect two repositories.
|
* Open a new transport instance to connect two repositories.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue