Package org.jenkinsci.plugins.gitclient
Class Git
java.lang.Object
org.jenkinsci.plugins.gitclient.Git
- All Implemented Interfaces:
Serializable
Git repository access class. Provides local and remote access to a git
repository through a
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.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanConstant which controls the default implementation to be used. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGitClientimplementation.Defines theFilePath(remotable directory) containing the git repository which will be used.Defines the local directory containing the git repository which will be used.Set the (node/environment specific) git executable to be used.static Gitwith(TaskListener listener, EnvVars env) Fluent constructor for a Git object.withHostKeyVerifierFactory(HostKeyVerifierFactory hostKeyFactory)
-
Field Details
-
USE_CLI
public static final boolean USE_CLIConstant which controls the default implementation to be used.USE_CLI=Boolean.valueOf(System.getProperty(Git.class.getName() + ".useCLI", "true")). Uses command line implementation (CliGitAPIImpl) by default.
-
-
Constructor Details
-
Git
Constructor for a Git object. EitherGit.with(listener, env)ornew Git(listener, env)can be used to construct a Git object.- Parameters:
listener- aTaskListenerwhich can be used to monitor git implementation operationsenv- aEnvVarswhich provides environment values to the git implementation
-
-
Method Details
-
with
Fluent constructor for a Git object. EitherGit.with(listener, env)or newGit(listener, env)can be used to construct a Git object.- Parameters:
listener- aTaskListenerwhich can be used to monitor git implementation operationsenv- aEnvVarswhich provides environment values to the git implementation- Returns:
- a
Gitobject for repository access
-
in
Defines the local directory containing the git repository which will be used. For repositories with a working directory, repository is the parent of the.gitdirectory. For bare repositories, repository is the parent of theobjectsdirectory. -
in
Defines theFilePath(remotable directory) containing the git repository which will be used. For repositories with a working directory, repository is the parent of the.gitdirectory. For bare repositories, repository is the parent of theobjectsdirectory. -
using
Set the (node/environment specific) git executable to be used. If not set, JGit implementation will be used. When default is used, it assumes the caller does not rely on unimplemented CLI methods.- Parameters:
exe- either "git" or "jgit"- Returns:
Gitobject for repository access
-
withHostKeyVerifierFactory
-
getClient
GitClientimplementation. TheGitClientinterface provides the key operations which can be performed on a git repository.- Returns:
- a
GitClientfor git operations on the repository - Throws:
IOException- if any IO failureInterruptedException- if interrupted.
-