Class GitAPI
- All Implemented Interfaces:
IGitAPI,Serializable,GitClient
Git.USE_CLI).
New implementations should use GitClient.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jenkinsci.plugins.gitclient.GitClient
GitClient.ConfigLevel -
Field Summary
FieldsFields inherited from class org.jenkinsci.plugins.gitclient.CliGitAPIImpl
TIMEOUT, USE_SETSIDFields inherited from interface org.jenkinsci.plugins.gitclient.GitClient
CREDENTIALS_MATCHER, quietRemoteBranches, verbose -
Constructor Summary
ConstructorsConstructorDescriptionGitAPI(String gitExe, FilePath repository, TaskListener listener, EnvVars environment) Deprecated.GitAPI(String gitExe, FilePath repository, TaskListener listener, EnvVars environment, String reference) Deprecated.GitAPI(String gitExe, File repository, TaskListener listener, EnvVars environment) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.add.voidDeprecated.branch.voidchangelog(String revFrom, String revTo, OutputStream outputStream) Deprecated.voidAdds the changelog entries for commits in the range revFrom..revTo.voidDeprecated.Checks out the specified commit/tag/branch into the workspace.voidDeprecated.Creates a new branch that points to the specified ref.voidcheckoutBranch(String branch, String ref) Regardless of the current state of the workspace (whether there is some dirty files, etc) and the state of the repository (whether the branch of the specified name exists or not), when this method exits the following conditions hold: The branch of the specified name branch exists and points to the specified refHEADpoints to branch.voidclean()Deprecated.Remove untracked files and directories, including files listed in the ignore rules.voidClone a remote repositoryvoidclone(org.eclipse.jgit.transport.RemoteConfig source) Deprecated.voidclone(org.eclipse.jgit.transport.RemoteConfig rc, boolean useShallowClone) Deprecated.voidDeprecated.commit.voidcommit(String message, org.eclipse.jgit.lib.PersonIdent author, org.eclipse.jgit.lib.PersonIdent committer) Deprecated.commit.voiddeleteBranch(String name) Deprecated.(force) delete a branch.voidDeprecated.deleteTag.protected StringextractBranchNameFromBranchSpec(String branchSpec) This method takes a branch specification and normalizes it get unambiguous results.voidfetch()Deprecated.voidDeprecated.voidDeprecated.fetch.voidDeprecated.fetch.voidfetch(org.eclipse.jgit.transport.RemoteConfig remoteRepository) Deprecated.voidDeprecated.Fetch commits from url which match any of the passed in refspecs.Deprecated.Returns the set of branches defined in this repository, including local branches and remote branches.Deprecated.Returns the remote branches defined in this repository.getRemoteUrl(String name) Deprecated.From a given repository, get a remote's URLorg.eclipse.jgit.lib.RepositoryDeprecated.Returns theRepositoryused by this git instance.getTagMessage(String tagName) Deprecated.getTagMessage.getTagsOnCommit(String revName) Deprecated.booleanhasGitModules.booleanhasGitModules(String treeIsh) Deprecated.booleanDeprecated.Returns true if this workspace has a git repository.booleanhasGitRepo(boolean checkParentDirectories) Deprecated.Returns true if this workspace has a git repository.voidinit()Deprecated.Initialize an empty repository for further git operations.booleanisBareRepository.booleanisCommitInRepo(org.eclipse.jgit.lib.ObjectId commit) Deprecated.isCommitInRepo.final List<IndexEntry>Deprecated.voidmerge(org.eclipse.jgit.lib.ObjectId rev) Deprecated.voidDeprecated.push.voidDeprecated.protected org.jenkinsci.plugins.gitclient.RemoteGitImplremoteProxyFor(GitClient proxy) remoteProxyFor.voidreset()Deprecated.List<org.eclipse.jgit.lib.ObjectId>revListBranch(String branchId) Deprecated.org.eclipse.jgit.lib.ObjectIdDeprecated.Retrieve commit object that is direct child forrevNamerevision reference.voidsetAuthor(org.eclipse.jgit.lib.PersonIdent p) setAuthor.voidsetCommitter(org.eclipse.jgit.lib.PersonIdent p) setCommitter.voidsetCredentials(com.cloudbees.plugins.credentials.common.StandardUsernameCredentials cred) setCredentials.voidsetHostKeyFactory(HostKeyVerifierFactory verifier) voidsetProxy(ProxyConfiguration proxy) setProxy.voidsetRemoteUrl(String name, String url) Deprecated.For a given repository, set a remote's URLvoidsetupSubmoduleUrls(String remote, TaskListener listener) Deprecated.Deprecated.showRevision(org.eclipse.jgit.lib.ObjectId r) Given a Revision, show it as if it were an entry from git log --raw, so that it can be parsed by GitChangeLogParser.Deprecated.subGit.voidsubmoduleUpdate(boolean recursive) Deprecated.voidsubmoduleUpdate(boolean recursive, boolean remoteTracking) Deprecated.voidsubmoduleUpdate(boolean recursive, boolean remoteTracking, String reference) Deprecated.voidsubmoduleUpdate(boolean recursive, String reference) Deprecated.voidDeprecated.Create (or update) a tag.booleanDeprecated.tagExists.<T> TwithRepository(RepositoryCallback<T> callable) Runs the computation that requires local access toRepository.protected ObjectWhen sent to remote, switch to the proxy.Methods inherited from class org.jenkinsci.plugins.gitclient.CliGitAPIImpl
addCredentials, addDefaultCredentials, addNote, addRemoteUrl, addSubmodule, appendNote, changelog, checkout, clean, clearCredentials, clone_, config, deleteRef, describe, fetch_, fixSubmoduleUrls, getAllLogEntries, getBranchesContaining, getBranchesContaining, getDefaultRemote, getDefaultRemote, getHeadRev, getHeadRev, getRefNames, getRemoteReferences, getRemoteSymbolicReferences, getRemoteTagNames, getRemoteUrl, getSSHExecutable, getSubmodulePath, getSubmodules, getSubmoduleUrl, getTagNames, getTags, getWorkTree, hasGitRepo, init_, isBareRepository, isCliGitVerAtLeast, isShallowRepository, launchCommand, launchCommand, lsTree, maintenance, merge, merge, mergeBase, prune, push, push, rebase, ref, refExists, reset, revList, revList_, revListAll, setAuthor, setCommitter, setRemoteUrl, setSubmoduleUrl, setupSubmoduleUrls, showRevision, showRevision, submoduleClean, submoduleInit, submoduleReset, submoduleSync, submoduleUpdate, validateRevisionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jenkinsci.plugins.gitclient.GitClient
changelog, clone, merge, setAuthor, setCommitter, setCredentials, setProxy, submoduleUpdate, submoduleUpdate, submoduleUpdate, submoduleUpdate, withRepositoryMethods inherited from interface hudson.plugins.git.IGitAPI
changelog, checkoutBranch
-
Field Details
-
workspace
-
proxy
-
-
Constructor Details
-
GitAPI
@Deprecated public GitAPI(String gitExe, FilePath repository, TaskListener listener, EnvVars environment) throws IOException, InterruptedException Deprecated.Constructor for GitAPI.- Parameters:
gitExe- name of git executable (git or git.exe or jgit)repository- aFilePathfor the repository directorylistener- aTaskListenerwhich monitors the git workenvironment- theEnvVarsenvironment for the build- Throws:
IOException- if any IO failureInterruptedException- if interrupted
-
GitAPI
@Deprecated public GitAPI(String gitExe, FilePath repository, TaskListener listener, EnvVars environment, String reference) throws IOException, InterruptedException Deprecated.Constructor for GitAPI.- Parameters:
gitExe- name of git executable (git or git.exe or jgit)repository- aFilePathfor the repository directorylistener- aTaskListenerwhich monitors the git workenvironment- theEnvVarsenvironment for the buildreference- SHA1 for checkout- Throws:
IOException- if any IO failureInterruptedException- if interrupted.
-
GitAPI
@Deprecated public GitAPI(String gitExe, File repository, TaskListener listener, EnvVars environment) throws IOException, InterruptedException Deprecated.Constructor for GitAPI.- Parameters:
gitExe- name of git executable (git or git.exe or jgit)repository- aFilePathfor the repository directorylistener- aTaskListenerwhich monitors the git workenvironment- theEnvVarsenvironment for the build- Throws:
IOException- if any IO failureInterruptedException- if interrupted.
-
-
Method Details
-
add
Deprecated.add.- Specified by:
addin interfaceGitClient- Overrides:
addin classCliGitAPIImpl- Parameters:
filePattern- aStringobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getRemoteUrl
Deprecated.From a given repository, get a remote's URL- Specified by:
getRemoteUrlin interfaceGitClient- Overrides:
getRemoteUrlin classCliGitAPIImpl- Parameters:
name- The name of the remote (e.g. origin)- Returns:
- a
Stringobject. - Throws:
GitException- if executing the git command failsInterruptedException- if interrupted.
-
push
Deprecated.push.- Specified by:
pushin interfaceGitClient- Parameters:
remoteName- aStringobject.refspec- aStringobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getTagMessage
Deprecated.getTagMessage.- Specified by:
getTagMessagein interfaceGitClient- Overrides:
getTagMessagein classCliGitAPIImpl- Parameters:
tagName- aStringobject.- Returns:
- a
Stringobject. - Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
subGit
Deprecated.subGit.- Specified by:
subGitin interfaceGitClient- Overrides:
subGitin classCliGitAPIImpl- Parameters:
subdir- aStringobject.- Returns:
- a IGitAPI implementation to manage git submodule repository
-
setRemoteUrl
Deprecated.For a given repository, set a remote's URL- Specified by:
setRemoteUrlin interfaceGitClient- Overrides:
setRemoteUrlin classCliGitAPIImpl- Parameters:
name- The name of the remote (e.g. origin)url- The new value of the remote's URL- Throws:
GitException- if executing the git command failsInterruptedException- if interrupted.
-
getBranches
Deprecated.Returns the set of branches defined in this repository, including local branches and remote branches. Remote branches are prefixed by "remotes/".- Specified by:
getBranchesin interfaceGitClient- Overrides:
getBranchesin classCliGitAPIImpl- Returns:
- a
Setobject. - Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getRemoteBranches
Deprecated.Returns the remote branches defined in this repository.- Specified by:
getRemoteBranchesin interfaceGitClient- Overrides:
getRemoteBranchesin classCliGitAPIImpl- Returns:
Setof remote branches in this repository- Throws:
GitException- if underlying git operation failsInterruptedException- if interrupted
-
init
Deprecated.Initialize an empty repository for further git operations.- Specified by:
initin interfaceGitClient- Overrides:
initin classCliGitAPIImpl- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
deleteBranch
Deprecated.(force) delete a branch.- Specified by:
deleteBranchin interfaceGitClient- Overrides:
deleteBranchin classCliGitAPIImpl- Parameters:
name- aStringobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
checkout
Deprecated.Creates a new branch that points to the specified ref. (equivalent to git checkout -b branch commit) This will fail if the branch already exists.- Specified by:
checkoutin interfaceGitClient- Parameters:
ref- A git object references expression. For backward compatibility,nullwill checkout current HEADbranch- name of the branch to create from reference- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
hasGitRepo
Deprecated.Returns true if this workspace has a git repository. Also returns true if this workspace contains an empty .git directory and a parent directory has a git repository.- Specified by:
hasGitRepoin interfaceGitClient- Overrides:
hasGitRepoin classCliGitAPIImpl- Returns:
- true if this workspace has a git repository
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
hasGitRepo
Deprecated.Returns true if this workspace has a git repository. If checkParentDirectories is true, searches parent directories. If checkParentDirectories is false, checks workspace directory only.- Specified by:
hasGitRepoin interfaceGitClient- Overrides:
hasGitRepoin classCliGitAPIImpl- Parameters:
checkParentDirectories- if true, search upward for a git repository- Returns:
- true if this workspace has a git repository
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
isCommitInRepo
public boolean isCommitInRepo(org.eclipse.jgit.lib.ObjectId commit) throws GitException, InterruptedException Deprecated.isCommitInRepo.- Specified by:
isCommitInRepoin interfaceGitClient- Overrides:
isCommitInRepoin classCliGitAPIImpl- Parameters:
commit- aObjectIdobject.- Returns:
- true if commit is in repository
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
commit
Deprecated.commit.- Specified by:
commitin interfaceGitClient- Overrides:
commitin classCliGitAPIImpl- Parameters:
message- aStringobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
commit
public void commit(String message, org.eclipse.jgit.lib.PersonIdent author, org.eclipse.jgit.lib.PersonIdent committer) throws GitException, InterruptedException Deprecated.commit.- Specified by:
commitin interfaceGitClient- Parameters:
message- aStringobject.author- aPersonIdentobject.committer- aPersonIdentobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
checkout
Deprecated.Checks out the specified commit/tag/branch into the workspace. (equivalent ofgit checkout branch.)- Specified by:
checkoutin interfaceGitClient- Parameters:
ref- A git object references expression (either a sha1, tag or branch)- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
deleteTag
Deprecated.deleteTag.- Specified by:
deleteTagin interfaceGitClient- Overrides:
deleteTagin classCliGitAPIImpl- Parameters:
tagName- aStringobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getRepository
Deprecated.Returns theRepositoryused by this git instance.- Specified by:
getRepositoryin interfaceGitClient- Overrides:
getRepositoryin classCliGitAPIImpl- Returns:
- a
Repositoryobject. - Throws:
GitException- if underlying git operation fails.
-
tag
Deprecated.Create (or update) a tag. If tag already exist it gets updated (equivalent togit tag --force)- Specified by:
tagin interfaceGitClient- Overrides:
tagin classCliGitAPIImpl- Parameters:
tagName- aStringobject.comment- aStringobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
fetch
public void fetch(org.eclipse.jgit.transport.URIish url, List<org.eclipse.jgit.transport.RefSpec> refspecs) throws GitException, InterruptedException Deprecated.Fetch commits from url which match any of the passed in refspecs. Assumesremote.remoteName.urlhas been set.- Specified by:
fetchin interfaceGitClient- Overrides:
fetchin classCliGitAPIImpl- Parameters:
url- aURIishobject.refspecs- aListobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
fetch
public void fetch(String remoteName, org.eclipse.jgit.transport.RefSpec... refspec) throws GitException, InterruptedException Deprecated.fetch.- Specified by:
fetchin interfaceGitClient- Overrides:
fetchin classCliGitAPIImpl- Parameters:
remoteName- aStringobject.refspec- aRefSpecobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
fetch
public void fetch(String remoteName, org.eclipse.jgit.transport.RefSpec refspec) throws GitException, InterruptedException Deprecated.fetch.- Specified by:
fetchin interfaceGitClient- Overrides:
fetchin classCliGitAPIImpl- Parameters:
remoteName- aStringobject.refspec- aRefSpecobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
tagExists
Deprecated.tagExists.- Specified by:
tagExistsin interfaceGitClient- Overrides:
tagExistsin classCliGitAPIImpl- Parameters:
tagName- aStringobject.- Returns:
- true if tag exists in repository
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
clean
Deprecated.Remove untracked files and directories, including files listed in the ignore rules.- Specified by:
cleanin interfaceGitClient- Overrides:
cleanin classCliGitAPIImpl- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
revParse
public org.eclipse.jgit.lib.ObjectId revParse(String revName) throws GitException, InterruptedException Deprecated.Retrieve commit object that is direct child forrevNamerevision reference.- Specified by:
revParsein interfaceGitClient- Overrides:
revParsein classCliGitAPIImpl- Parameters:
revName- a commit sha1 or tag/branch refname- Returns:
- a
ObjectIdobject. - Throws:
GitException- when no such commit / revName is found in repository.InterruptedException- if interrupted.
-
branch
Deprecated.branch.- Specified by:
branchin interfaceGitClient- Overrides:
branchin classCliGitAPIImpl- Parameters:
name- aStringobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
isBareRepository
isBareRepository.- Specified by:
isBareRepositoryin interfaceIGitAPI- Returns:
- true if this repository is a bare repository
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getHostKeyFactory
-
setHostKeyFactory
-
hasGitModules
Deprecated.Returns true if this repository has submodules.- Specified by:
hasGitModulesin interfaceIGitAPI- Parameters:
treeIsh- an ignored argument, kept for compatibility- Returns:
- true if this repository has submodules (git modules file)
- Throws:
GitException- if underlying git operation fails.- See Also:
-
setupSubmoduleUrls
@Deprecated public void setupSubmoduleUrls(String remote, TaskListener listener) throws GitException, InterruptedException Deprecated.- Specified by:
setupSubmoduleUrlsin interfaceIGitAPI- Throws:
GitExceptionInterruptedException
-
fetch
@Deprecated public void fetch(String repository, String refspec) throws GitException, InterruptedException Deprecated.Retrieve commits based on refspec from repository.- Specified by:
fetchin interfaceIGitAPI- Parameters:
repository- URL of the repository to be retrievedrefspec- definition of mapping from remote refs to local refs- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
fetch
@Deprecated public void fetch(org.eclipse.jgit.transport.RemoteConfig remoteRepository) throws GitException, InterruptedException Deprecated.Retrieve commits from RemoteConfig.- Specified by:
fetchin interfaceIGitAPI- Parameters:
remoteRepository- remote configuration from which refs will be retrieved- Throws:
InterruptedException- if interrupted.GitException
-
fetch
Deprecated.fetch.- Specified by:
fetchin interfaceIGitAPI- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
reset
Deprecated.reset.- Specified by:
resetin interfaceIGitAPI- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
push
@Deprecated public void push(org.eclipse.jgit.transport.URIish url, String refspec) throws GitException, InterruptedException Deprecated.push.- Specified by:
pushin interfaceGitClient- Parameters:
url- aURIishobject.refspec- aStringobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
clone
@Deprecated public void clone(org.eclipse.jgit.transport.RemoteConfig source) throws GitException, InterruptedException Deprecated.Clone repository from source to this repository.- Specified by:
clonein interfaceIGitAPI- Parameters:
source- remote repository to be cloned- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
clone
@Deprecated public void clone(org.eclipse.jgit.transport.RemoteConfig rc, boolean useShallowClone) throws GitException, InterruptedException Deprecated.Clone repository fromRemoteConfigrc to this repository.- Specified by:
clonein interfaceIGitAPI- Parameters:
rc- the remote config for the remote repositoryuseShallowClone- if true, use a shallow clone- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
revListBranch
@Deprecated public List<org.eclipse.jgit.lib.ObjectId> revListBranch(String branchId) throws GitException, InterruptedException Deprecated.revListBranch.- Specified by:
revListBranchin interfaceIGitAPI- Parameters:
branchId- aStringobject.- Returns:
- a
Listobject. - Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
showRevision
Deprecated.showRevision.- Specified by:
showRevisionin interfaceIGitAPI- Parameters:
r- aRevisionobject.- Returns:
- a
Listobject. - Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getTagsOnCommit
Deprecated.getTagsOnCommit.- Specified by:
getTagsOnCommitin interfaceIGitAPI- Parameters:
revName- aStringobject.- Returns:
- a
Listobject. - Throws:
GitException- if underlying git operation fails.IOException- if any IO failure
-
lsTree
@Deprecated public final List<IndexEntry> lsTree(String treeIsh) throws GitException, InterruptedException Deprecated.This method has been implemented as non-recursive historically, but often that is not what the caller wants.- Specified by:
lsTreein interfaceIGitAPI- Parameters:
treeIsh- string representation of a treeIsh item- Returns:
- list of IndexEntry items starting at treeIsh
- Throws:
GitException- on failureInterruptedException- if interrupted
-
writeReplace
When sent to remote, switch to the proxy.- Returns:
- a
Objectobject. - Throws:
ObjectStreamException- if current channel is null
-
hasGitModules
hasGitModules.- Specified by:
hasGitModulesin interfaceGitClient- Returns:
- true if this repositor has one or more submodules
- Throws:
GitException- if underlying git operation fails.
-
showRevision
public List<String> showRevision(org.eclipse.jgit.lib.ObjectId r) throws GitException, InterruptedException Given a Revision, show it as if it were an entry from git log --raw, so that it can be parsed by GitChangeLogParser.Changes are computed on the [from..to] range. If
fromis null, this prints just one commit thattorepresents.For merge commit, this method reports one diff per each parent. This makes this method behave differently from
GitClient.changelog().- Specified by:
showRevisionin interfaceGitClient- Parameters:
r- aObjectIdobject.- Returns:
- The git log output, in
rawformat. - Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
extractBranchNameFromBranchSpec
This method takes a branch specification and normalizes it get unambiguous results. This is the case when using "refs/heads/"
TODO: Currently only for specs starting with "refs/heads/" the implementation is correct. All others branch specs should also be normalized to "refs/heads/" in order to get unambiguous results. To achieve this it is necessary to identify remote names in the branch spec and to discuss how to handle clashes (e.g. "remoteName/main" for branch "main" (refs/heads/main) in remote "remoteName" and branch "remoteName/main" (refs/heads/remoteName/main)).
Existing behavior is intentionally being retained so that current use cases are not disrupted by a behavioral change.
E.g.Branch Spec Normalization Examples branch spec normalized mainmain*feature1feature1*feature1/mainmainfeature1/main*origin/mainmain*repo2/feature1feature1*refs/heads/feature1refs/heads/feature1origin/namespaceA/fix15 fix15namespaceA/fix15*refs/heads/namespaceA/fix15refs/heads/namespaceA/fix15remotes/origin/namespaceA/fix15refs/heads/namespaceA/fix15
*) TODO: Normalize to "refs/heads/"- Parameters:
branchSpec- aStringobject.- Returns:
- normalized branch name
-
withRepository
public <T> T withRepository(RepositoryCallback<T> callable) throws GitException, IOException, InterruptedException Runs the computation that requires local access toRepository.- Specified by:
withRepositoryin interfaceGitClient- Type Parameters:
T- type for the repository callback- Parameters:
callable- the repository callback used as closure to instance- Returns:
- a T object.
- Throws:
IOException- in case of IO errorInterruptedException- if interruptedGitException
-
setAuthor
setAuthor.- Specified by:
setAuthorin interfaceGitClient- Parameters:
p- aPersonIdentobject.- Throws:
GitException- if underlying git operation fails.
-
setCommitter
setCommitter.- Specified by:
setCommitterin interfaceGitClient- Parameters:
p- aPersonIdentobject.- Throws:
GitException- if underlying git operation fails.
-
changelog
@Deprecated public void changelog(String revFrom, String revTo, OutputStream outputStream) throws GitException, InterruptedException Deprecated.changelog.- Specified by:
changelogin interfaceGitClient- Parameters:
revFrom- aStringobject.revTo- aStringobject.outputStream- aOutputStreamobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
changelog
public void changelog(String revFrom, String revTo, Writer w) throws GitException, InterruptedException Adds the changelog entries for commits in the range revFrom..revTo. This is just a short cut for callingGitClient.changelog()with appropriate parameters.- Specified by:
changelogin interfaceGitClient- Parameters:
revFrom- aStringobject.revTo- aStringobject.w- aWriterobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
clone
public void clone(String url, String origin, boolean useShallowClone, String reference) throws GitException, InterruptedException Clone a remote repository- Specified by:
clonein interfaceGitClient- Parameters:
url- URL for remote repository to cloneorigin- upstream track name, defaults tooriginby conventionuseShallowClone- option to create a shallow clone, that has some restriction but will make clone operationreference- (optional) reference to a local clone for faster clone operations (reduce network and local storage costs)- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
checkoutBranch
Regardless of the current state of the workspace (whether there is some dirty files, etc) and the state of the repository (whether the branch of the specified name exists or not), when this method exits the following conditions hold:- The branch of the specified name branch exists and points to the specified ref
HEADpoints to branch. In other words, the workspace is on the specified branch.- Both index and workspace are the same tree with ref. (no dirty files and no staged changes, although this method will not touch untracked files in the workspace.)
This method is preferred over the
GitClient.checkout(String, String)family of methods, as this method is affected far less by the current state of the repository. Thecheckoutmethods, in their attempt to emulate the "git checkout" command line behaviour, have too many side effects. In Jenkins, where you care a lot less about throwing away local changes and care a lot more about resetting the workspace into a known state, methods like this is more useful.For compatibility reasons, the order of the parameter is different from
GitClient.checkout(String, String).- Specified by:
checkoutBranchin interfaceGitClient- Parameters:
branch- aStringobject.ref- aStringobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
merge
@Deprecated public void merge(org.eclipse.jgit.lib.ObjectId rev) throws GitException, InterruptedException Deprecated.merge.- Specified by:
mergein interfaceGitClient- Parameters:
rev- aObjectIdobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
remoteProxyFor
remoteProxyFor.- Parameters:
proxy- aGitClientobject.- Returns:
- a
RemoteGitImplobject.
-
setCredentials
public void setCredentials(com.cloudbees.plugins.credentials.common.StandardUsernameCredentials cred) setCredentials.- Specified by:
setCredentialsin interfaceGitClient- Parameters:
cred- aStandardUsernameCredentialsobject.
-
setProxy
setProxy.- Specified by:
setProxyin interfaceGitClient- Parameters:
proxy- aProxyConfigurationobject.
-
submoduleUpdate
@Deprecated public void submoduleUpdate(boolean recursive) throws GitException, InterruptedException Deprecated.Run submodule update optionally recursively on all submodules (equivalent ofgit submodule update --recursive.)- Specified by:
submoduleUpdatein interfaceGitClient- Parameters:
recursive- a boolean.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
submoduleUpdate
@Deprecated public void submoduleUpdate(boolean recursive, String reference) throws GitException, InterruptedException Deprecated.Run submodule update optionally recursively on all submodules, with a specific reference passed to git clone if needing to --init. (equivalent ofgit submodule update --recursive --reference 'reference'.)- Specified by:
submoduleUpdatein interfaceGitClient- Parameters:
recursive- a boolean.reference- aStringobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
submoduleUpdate
@Deprecated public void submoduleUpdate(boolean recursive, boolean remoteTracking) throws GitException, InterruptedException Deprecated.Run submodule update optionally recursively on all submodules, optionally with remoteTracking submodules (equivalent ofgit submodule update --recursive --remote.)- Specified by:
submoduleUpdatein interfaceGitClient- Parameters:
recursive- a boolean.remoteTracking- a boolean.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
submoduleUpdate
@Deprecated public void submoduleUpdate(boolean recursive, boolean remoteTracking, String reference) throws GitException, InterruptedException Deprecated.Run submodule update optionally recursively on all submodules, optionally with remoteTracking, with a specific reference passed to git clone if needing to --init. (equivalent ofgit submodule update --recursive --remote --reference 'reference'.)- Specified by:
submoduleUpdatein interfaceGitClient- Parameters:
recursive- a boolean.remoteTracking- a boolean.reference- aStringobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-