Package com.zfabrik.impl.gitcr.helper
Class GitTools
- java.lang.Object
-
- com.zfabrik.impl.gitcr.helper.GitTools
-
public class GitTools extends java.lang.Object
Provides some useful static helpers like#isOriginReachable(URIish)
,#isValidRepository(URIish)
,#cloneRepository(URIish, File, CredentialsProvider, int)
, ...
-
-
Constructor Summary
Constructors Constructor Description GitTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
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.RefSpec fetchSpec, org.eclipse.jgit.transport.CredentialsProvider credentials, int timeout, java.lang.Integer depth)
Clones the given remote repository into the given destination folder.static void
fetchRepository(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.transport.RefSpec fetchSpec, org.eclipse.jgit.transport.CredentialsProvider credentials, int timeout, java.lang.Integer depth)
Fetch deltas from a source-repository
-
-
-
Method Detail
-
cloneRepository
public static org.eclipse.jgit.lib.Repository cloneRepository(org.eclipse.jgit.transport.URIish remoteUri, java.io.File destFolder, org.eclipse.jgit.transport.RefSpec fetchSpec, org.eclipse.jgit.transport.CredentialsProvider credentials, int timeout, java.lang.Integer depth) throws java.io.IOException
Clones the given remote repository into the given destination folder. The method clones all branches but doesn't perform a checkout.- Parameters:
remoteUri
- URI of the remote repositorydestFolder
- local destination foldercredentials
- user credentials- Returns:
- the cloned repository
- Throws:
java.io.IOException
- if something went wrong
-
checkOutRef
public static java.lang.String checkOutRef(org.eclipse.jgit.lib.Repository repo, java.lang.String ref) throws java.io.IOException
Checks out the given ref branch in the given repository.- Parameters:
targetBranch
- a local or remote branch name.- Throws:
java.io.IOException
- if something went wrong
-
fetchRepository
public static void fetchRepository(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.transport.RefSpec fetchSpec, org.eclipse.jgit.transport.CredentialsProvider credentials, int timeout, java.lang.Integer depth) throws java.lang.Exception
Fetch deltas from a source-repository- Throws:
java.lang.Exception
-
-