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
Modifier and TypeFieldDescriptionstatic final boolean
Constant which controls the default implementation to be used. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGitClient
implementation.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 Git
with
(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
- aTaskListener
which can be used to monitor git implementation operationsenv
- aEnvVars
which 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
- aTaskListener
which can be used to monitor git implementation operationsenv
- aEnvVars
which provides environment values to the git implementation- Returns:
- a
Git
object 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.git
directory. For bare repositories, repository is the parent of theobjects
directory. -
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.git
directory. For bare repositories, repository is the parent of theobjects
directory. -
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:
Git
object for repository access
-
withHostKeyVerifierFactory
-
getClient
GitClient
implementation. TheGitClient
interface provides the key operations which can be performed on a git repository.- Returns:
- a
GitClient
for git operations on the repository - Throws:
IOException
- if any IO failureInterruptedException
- if interrupted.
-