public class Git extends Object implements Serializable
GitClient implementation. Current git
implementations include either command line git ("git" -
CliGitAPIImpl) or JGit ("jgit" - JGitAPIImpl).
The command line git implementation requires a separately installed git
program. The command line git implementation is the current reference
implementation.
The JGit implementation is bundled entirely within the git client plugin and
does not require any external programs. The JGit implementation is not yet
functionally complete, though it handles most use cases.| Modifier and Type | Field and Description |
|---|---|
static boolean |
USE_CLI
Constant which controls the default implementation to be used.
|
| Constructor and Description |
|---|
Git(hudson.model.TaskListener listener,
hudson.EnvVars env)
Constructor for a Git object.
|
| Modifier and Type | Method and Description |
|---|---|
GitClient |
getClient()
GitClient implementation. |
Git |
in(File repository)
Defines the local directory containing the git repository which will be
used.
|
Git |
in(hudson.FilePath repository)
Defines the
FilePath (remotable directory) containing the
git repository which will be used. |
Git |
using(String exe)
Set the (node/environment specific) git executable to be used.
|
static Git |
with(hudson.model.TaskListener listener,
hudson.EnvVars env)
Fluent constructor for a Git object.
|
public static final boolean USE_CLI
USE_CLI=Boolean.valueOf(System.getProperty(Git.class.getName() + ".useCLI", "true")).
Uses command line implementation (CliGitAPIImpl) by default.public Git(hudson.model.TaskListener listener,
hudson.EnvVars env)
Git.with(listener, env)
or new Git(listener, env) can be used to construct a Git
object.listener - a TaskListener which can be used to
monitor git implementation operationsenv - a EnvVars which provides environment values to
the git implementationpublic static Git with(hudson.model.TaskListener listener, hudson.EnvVars env)
Git.with(listener, env) or new
Git(listener, env) can be used to construct a Git object.listener - a TaskListener which can be used to
monitor git implementation operationsenv - a EnvVars which provides environment values to
the git implementationGit object for repository accesspublic Git in(File repository)
.git directory. For bare repositories, repository is
the parent of the objects directory.public Git in(hudson.FilePath repository)
FilePath (remotable directory) containing the
git repository which will be used. For repositories with a working
directory, repository is the parent of the .git directory.
For bare repositories, repository is the parent of the
objects directory.repository - FilePath of the git repository.Git object for repository accesspublic Git using(String exe)
exe - either "git" or "jgit"Git object for repository accesspublic GitClient getClient() throws IOException, InterruptedException
GitClient implementation. The GitClient interface
provides the key operations which can be performed on a git repository.GitClient for git operations on the repositoryIOException - if any IO failureInterruptedException - if interrupted.Copyright © 2013–2020. All rights reserved.