public class GitTools
extends java.lang.Object
isOriginReachable(URIish)
, isValidRepository(URIish)
, cloneRepository(URIish, File, CredentialsProvider, int)
, ...Modifier and Type | Class | Description |
---|---|---|
static class |
GitTools.ValidationResult |
Constructor | Description |
---|---|
GitTools() |
Modifier and Type | Method | Description |
---|---|---|
static void |
checkOutRef(org.eclipse.jgit.lib.Repository repo,
java.lang.String ref) |
Checks out the given ref branch in the given repository.
|
static org.eclipse.jgit.lib.Repository |
cloneRepository(org.eclipse.jgit.transport.URIish remoteUri,
java.io.File destFolder,
org.eclipse.jgit.transport.CredentialsProvider credentials,
int timeout) |
Clones the given remote repository into the given destination folder.
|
static boolean |
isOriginReachable(org.eclipse.jgit.transport.URIish repoUri) |
Returns true if repoUri is local.
|
static GitTools.ValidationResult |
isValidRepository(org.eclipse.jgit.transport.URIish repoUri) |
Checks whether the given repository is valid.
|
static void |
main(java.lang.String[] args) |
public static boolean isOriginReachable(org.eclipse.jgit.transport.URIish repoUri)
repoUri
- a Git-URIishpublic static GitTools.ValidationResult isValidRepository(org.eclipse.jgit.transport.URIish repoUri)
GitTools.ValidationResult.cannotTell
for all other schemas.repoUri
- repository uriGitTools.ValidationResult.valid
: repoUri points to a valid repositoryGitTools.ValidationResult.invalid
: repoUri points to an invalid repository, or the remote side is not reachableGitTools.ValidationResult.cannotTell
: repoUri cannot be validated (because there is no validation for repoUri's scheme available)public static org.eclipse.jgit.lib.Repository cloneRepository(org.eclipse.jgit.transport.URIish remoteUri, java.io.File destFolder, org.eclipse.jgit.transport.CredentialsProvider credentials, int timeout) throws java.io.IOException
remoteUri
- URI of the remote repositorydestFolder
- local destination foldercredentials
- user credentialsjava.io.IOException
- if something went wrongpublic static void checkOutRef(org.eclipse.jgit.lib.Repository repo, java.lang.String ref) throws java.io.IOException
targetBranch
- a local or remote branch name.java.io.IOException
- if something went wrongpublic static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception