Git Module

Provides functions to access and operate on git repositories through JGIT.

Method Overview

Method Description
add() Get repository status.
clone() Clone a git repository.
commit() Commit to a repository.
getRepositoryConfig() Read a repository configuration entry.
getStatus() Get repository status.
initRepository() Initialize a fresh repository.
openRepository() Open a local repository.
pull() Pull a repository.
push() Push a repository.
setRepositoryConfig() Set a repository configuration entry.

Methods

add

org.eclipse.jgit.dircache.DirCache add(Object repository, String filepattern) throws IOException, org.eclipse.jgit.api.errors.NoFilepatternException, org.eclipse.jgit.api.errors.GitAPIException

Get repository status.

repository
repository instance or location (local) to get status from
filepattern
repository-relative path of file/directory to add (with / as separator)

add result

IOException
when resource cannot be accessed
org.eclipse.jgit.api.errors.NoFilepatternException
when filepattern is empty
org.eclipse.jgit.api.errors.GitAPIException
on a general error during git execution

clone

org.eclipse.jgit.api.Git clone(String remoteLocation, [Object localLocation], [String user], [String pass], [String branch]) throws org.eclipse.jgit.api.errors.InvalidRemoteException, org.eclipse.jgit.api.errors.TransportException, org.eclipse.jgit.api.errors.GitAPIException

Clone a git repository.

remoteLocation
location to fetch repository from
localLocation
local path to be used (null for workspace folder)Optional: defaults to <rg.eclipse.ease.modules.ScriptParameter.nul>.
user
username for the remote repositoryOptional: defaults to <null>.
pass
password for the remote repositoryOptional: defaults to <null>.
branch
branch to checkout (null for all branches)Optional: defaults to <null>.

GIT API instance

org.eclipse.jgit.api.errors.InvalidRemoteException
when command was called with an invalid remote
org.eclipse.jgit.api.errors.TransportException
when transport operation failed
org.eclipse.jgit.api.errors.GitAPIException
on a general error during git execution

commit

org.eclipse.jgit.revwalk.RevCommit commit(Object repository, String message, [String author], [boolean amend]) throws IOException, org.eclipse.jgit.api.errors.GitAPIException

Commit to a repository.

repository
repository instance or location (local) to pull
message
commit message
author
author to be used for the commit. Use format 'Real Name <email@address>'Optional: defaults to <null>.
amend
whether to amend the previous commitOptional: defaults to <als>.

commit result

IOException
the repository could not be accessed
org.eclipse.jgit.api.errors.GitAPIException
on a general error during git execution

getRepositoryConfig

String getRepositoryConfig(org.eclipse.jgit.api.Git repository, String section, String subsection, String name)

Read a repository configuration entry.

repository
repository to read setting from
section
config section (eg: 'user')
subsection
subsection or null
name
value name (eg: 'email')

configuration content

getStatus

org.eclipse.jgit.api.Status getStatus(Object repository) throws IOException, org.eclipse.jgit.api.errors.GitAPIException

Get repository status.

repository
repository instance or location (local) to get status from

repository status

IOException
when resource cannot be accessed
org.eclipse.jgit.api.errors.GitAPIException
on a general error during git execution

initRepository

org.eclipse.jgit.api.Git initRepository(Object location, [boolean bare]) throws org.eclipse.jgit.api.errors.GitAPIException

Initialize a fresh repository.

location
repository location
bare
true for bare repositoriesOptional: defaults to <als>.

GIT API instance

org.eclipse.jgit.api.errors.GitAPIException
on a general error during git execution

openRepository

org.eclipse.jgit.api.Git openRepository(Object location) throws IOException

Open a local repository.

location
local repository root folder

GIT API instance

IOException
when resource cannot be accessed

pull

org.eclipse.jgit.api.PullResult pull(Object repository) throws IOException, org.eclipse.jgit.api.errors.GitAPIException

Pull a repository.

repository
repository instance or location (local) to pull

pull result

IOException
when resource cannot be accessed
org.eclipse.jgit.api.errors.GitAPIException
on a general error during git execution

push

Iterable<org.eclipse.jgit.transport.PushResult> push(Object repository) throws IOException, org.eclipse.jgit.api.errors.GitAPIException

Push a repository.

repository
repository instance or location (local) to pull

push result

IOException
when resource cannot be accessed
org.eclipse.jgit.api.errors.GitAPIException
on a general error during git execution

setRepositoryConfig

void setRepositoryConfig(org.eclipse.jgit.api.Git repository, String section, String subsection, String name, String value)

Set a repository configuration entry.

repository
repository to apply setting on
section
config section (eg: 'user')
subsection
subsection or null
name
value name (eg: 'email')
value
value to set