Class LfsConnectionFactory
java.lang.Object
org.eclipse.jgit.lfs.internal.LfsConnectionFactory
Provides means to get a valid LFS connection for a given repository.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpConnectiongetLfsConnection(Repository db, String method, String purpose) Determine URL of LFS server by looking into config parameters lfs.url, lfs.static HttpConnectiongetLfsContentConnection(Repository repo, Protocol.Action action, String method) Create a connection for the specifiedProtocol.Action.static Protocol.RequesttoRequest(String operation, LfsPointer... resources)
-
Constructor Details
-
LfsConnectionFactory
public LfsConnectionFactory()
-
-
Method Details
-
getLfsConnection
public static HttpConnection getLfsConnection(Repository db, String method, String purpose) throws IOException Determine URL of LFS server by looking into config parameters lfs.url, lfs.[remote].url or remote.[remote].url. The LFS server URL is computed from remote.[remote].url by appending "/info/lfs". In case there is no URL configured, a SSH remote URI can be used to auto-detect the LFS URI by using the remote "git-lfs-authenticate" command.- Parameters:
db- the repository to work withmethod- the method (GET,PUT,...) of the request this connection will be used forpurpose- the action, e.g. Protocol.OPERATION_DOWNLOAD- Returns:
- the url for the lfs server. e.g. "https://github.com/github/git-lfs.git/info/lfs"
- Throws:
IOException
-
getLfsContentConnection
@NonNull public static HttpConnection getLfsContentConnection(Repository repo, Protocol.Action action, String method) throws IOException Create a connection for the specifiedProtocol.Action.- Parameters:
repo- the repo to fetch required configuration fromaction- the action for which to create a connectionmethod- the target method (GET or PUT)- Returns:
- a connection. output mode is not set.
- Throws:
IOException- in case of any error.
-
toRequest
- Parameters:
operation- the operation to perform, e.g. Protocol.OPERATION_DOWNLOADresources- the LFS resources affected- Returns:
- a request that can be serialized to JSON
-