Class JGitAPIImpl
- java.lang.Object
-
- org.jenkinsci.plugins.gitclient.JGitAPIImpl
-
- All Implemented Interfaces:
IGitAPI,Serializable,GitClient
public class JGitAPIImpl extends Object
GitClient pure Java implementation using JGit. Goal is to eventually get a full java implementation for GitClient For internal use only, don't use directly. SeeGit- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jenkinsci.plugins.gitclient.GitClient
GitClient.ConfigLevel
-
-
Field Summary
Fields Modifier and Type Field Description protected ProxyConfigurationproxystatic StringSSH_CONFIG_PATHprotected Fileworkspace-
Fields inherited from interface org.jenkinsci.plugins.gitclient.GitClient
CREDENTIALS_MATCHER, quietRemoteBranches, verbose
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(String filePattern)add.voidaddCredentials(String url, com.cloudbees.plugins.credentials.common.StandardCredentials credentials)Adds credentials to be used against a specific url.voidaddDefaultCredentials(com.cloudbees.plugins.credentials.common.StandardCredentials credentials)Adds credentials to be used when there are not url specific credentials defined.voidaddNote(String note, String namespace)Adds a new git-note on the current HEAD commit.voidaddRemoteUrl(String name, String url)addRemoteUrl.voidaddSubmodule(String remoteURL, String subdir)Create a submodule in subdir child directory for remote repositoryvoidappendNote(String note, String namespace)Appends to an existing git-note on the current HEAD commit.voidbranch(String name)branch.org.eclipse.jgit.transport.sshd.SshdSessionFactorybuildSshdSessionFactory(HostKeyVerifierFactory hostKeyVerifierFactory)ChangelogCommandchangelog()changelog.voidchangelog(String revFrom, String revTo, OutputStream outputStream)changelog.voidchangelog(String revFrom, String revTo, Writer w)Adds the changelog entries for commits in the range revFrom..revTo.CheckoutCommandcheckout()checkout.voidcheckout(String commit)Checks out the specified commit/tag/branch into the workspace.voidcheckout(String ref, String branch)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()clean.voidclean(boolean cleanSubmodule)clean.voidclearCredentials()clearCredentials.voidclone(String url, String origin, boolean useShallowClone, String reference)Clone a remote repositoryvoidclone(org.eclipse.jgit.transport.RemoteConfig source)Deprecated.voidclone(org.eclipse.jgit.transport.RemoteConfig rc, boolean useShallowClone)Deprecated.CloneCommandclone_()clone_.voidcommit(String message)commit.voidcommit(String message, org.eclipse.jgit.lib.PersonIdent author, org.eclipse.jgit.lib.PersonIdent committer)commit.voidconfig(GitClient.ConfigLevel configLevel, String key, String value)Execute git config at the specified configuration level.voiddeleteBranch(String name)(force) delete a branch.voiddeleteRef(String refName)Deletes a ref.voiddeleteTag(String tagName)deleteTag.Stringdescribe(String tip)Equivalent of "git-describe --tags".protected StringextractBranchNameFromBranchSpec(String branchSpec)This method takes a branch specification and normalizes it get unambiguous results.voidfetch()Deprecated.voidfetch(String repository, String refspec)Deprecated.voidfetch(String remoteName, org.eclipse.jgit.transport.RefSpec refspec)fetch.voidfetch(String remoteName, org.eclipse.jgit.transport.RefSpec... refspec)fetch.voidfetch(org.eclipse.jgit.transport.RemoteConfig remoteRepository)Deprecated.voidfetch(org.eclipse.jgit.transport.URIish url, List<org.eclipse.jgit.transport.RefSpec> refspecs)Fetch commits from url which match any of the passed in refspecs.FetchCommandfetch_()fetch_.voidfixSubmoduleUrls(String remote, TaskListener listener)Deprecated.StringgetAllLogEntries(String branch)Deprecated.Set<Branch>getBranches()getBranches.List<Branch>getBranchesContaining(String revspec)Find all the branches that include the given commit.List<Branch>getBranchesContaining(String revspec, boolean allBranches)Find all the branches that include the given commit.Set<Branch>getBranchesInternal(org.eclipse.jgit.api.ListBranchCommand.ListMode mode)StringgetDefaultRemote(String _default_)Deprecated.Map<String,org.eclipse.jgit.lib.ObjectId>getHeadRev(String url)getHeadRev.org.eclipse.jgit.lib.ObjectIdgetHeadRev(String remoteRepoUrl, String branchSpec)getHeadRev.HostKeyVerifierFactorygetHostKeyFactory()SmartCredentialsProvidergetProvider()Set<String>getRefNames(String refPrefix)List refs with the given prefix.Set<Branch>getRemoteBranches()getRemoteBranches.Map<String,org.eclipse.jgit.lib.ObjectId>getRemoteReferences(String url, String pattern, boolean headsOnly, boolean tagsOnly)List references in a remote repository.Map<String,String>getRemoteSymbolicReferences(String url, String pattern)List symbolic references in a remote repository.Set<String>getRemoteTagNames(String tagPattern)getRemoteTagNames.StringgetRemoteUrl(String name)From a given repository, get a remote's URLStringgetRemoteUrl(String name, String GIT_DIR)Deprecated.org.eclipse.jgit.lib.RepositorygetRepository()getRepository.List<IndexEntry>getSubmodules(String treeIsh)Finds all the submodule references in this repository at the specified tree.StringgetSubmoduleUrl(String name)Deprecated.StringgetTagMessage(String tagName)getTagMessage.Set<String>getTagNames(String tagPattern)getTagNames.Set<GitObject>getTags()Return name and object ID of all tags in current repository.List<Tag>getTagsOnCommit(String revName)Deprecated.FilePathgetWorkTree()getWorkTree.booleanhasGitModules()hasGitModules.booleanhasGitModules(String treeIsh)Deprecated.booleanhasGitRepo()Returns true if the current workspace has a git repository.booleanhasGitRepo(boolean checkParentDirectories)Returns true if the current workspace has a git repository.voidinit()init.InitCommandinit_()init_.booleanisBareRepository()isBareRepository.booleanisBareRepository(String GIT_DIR)Deprecated.booleanisCommitInRepo(org.eclipse.jgit.lib.ObjectId commit)isCommitInRepo.List<IndexEntry>lsTree(String treeIsh)This method has been implemented as non-recursive historically, but often that is not what the caller wants.List<IndexEntry>lsTree(String treeIsh, boolean recursive)Deprecated.booleanmaintenance(String task)Executes git maintenance commands based on the git version.MergeCommandmerge()merge.voidmerge(String refSpec)Deprecated.voidmerge(org.eclipse.jgit.lib.ObjectId rev)merge.org.eclipse.jgit.lib.ObjectIdmergeBase(org.eclipse.jgit.lib.ObjectId id1, org.eclipse.jgit.lib.ObjectId id2)Deprecated.voidprune(org.eclipse.jgit.transport.RemoteConfig repository)Prune stale remote tracking branches with "git remote prune" on the specified remote.PushCommandpush()push.voidpush(String remoteName, String refspec)Deprecated.voidpush(org.eclipse.jgit.transport.RemoteConfig repository, String refspec)Deprecated.voidpush(org.eclipse.jgit.transport.URIish url, String refspec)Deprecated.RebaseCommandrebase()rebase.voidref(String refName)Create (or update) a ref.booleanrefExists(String refName)Check if a ref exists.protected org.jenkinsci.plugins.gitclient.RemoteGitImplremoteProxyFor(GitClient proxy)remoteProxyFor.voidreset()Deprecated.voidreset(boolean hard)Deprecated.List<org.eclipse.jgit.lib.ObjectId>revList(String ref)revList.RevListCommandrevList_()revList_.List<org.eclipse.jgit.lib.ObjectId>revListAll()revListAll.List<org.eclipse.jgit.lib.ObjectId>revListBranch(String branchId)Deprecated.org.eclipse.jgit.lib.ObjectIdrevParse(String revName)Retrieve commit object that is direct child forrevNamerevision reference.voidsetAuthor(String name, String email)Sets the identity of the author for future commits and merge operations.voidsetAuthor(org.eclipse.jgit.lib.PersonIdent p)setAuthor.voidsetCommitter(String name, String email)Sets the identity of the committer for future commits and merge operations.voidsetCommitter(org.eclipse.jgit.lib.PersonIdent p)setCommitter.voidsetCredentials(com.cloudbees.plugins.credentials.common.StandardUsernameCredentials cred)setCredentials.voidsetCredentialsProvider(org.eclipse.jgit.transport.CredentialsProvider prov)setCredentialsProvider.voidsetHostKeyFactory(HostKeyVerifierFactory verifier)voidsetProxy(ProxyConfiguration proxy)setProxy.voidsetRemoteUrl(String name, String url)For a given repository, set a remote's URLvoidsetRemoteUrl(String name, String url, String GIT_DIR)Deprecated.voidsetSubmoduleUrl(String name, String url)Deprecated.voidsetupSubmoduleUrls(Revision rev, TaskListener listener)Deprecated.voidsetupSubmoduleUrls(String remote, TaskListener listener)Deprecated.List<String>showRevision(Revision r)Deprecated.List<String>showRevision(org.eclipse.jgit.lib.ObjectId r)Given a Revision, show it as if it were an entry from git whatchanged, so that it can be parsed by GitChangeLogParser.List<String>showRevision(org.eclipse.jgit.lib.ObjectId from, org.eclipse.jgit.lib.ObjectId to)Given a Revision, show it as if it were an entry from git whatchanged, so that it can be parsed by GitChangeLogParser.List<String>showRevision(org.eclipse.jgit.lib.ObjectId from, org.eclipse.jgit.lib.ObjectId to, Boolean useRawOutput)Given a Revision, show it as if it were an entry from git whatchanged, so that it can be parsed by GitChangeLogParser.GitClientsubGit(String subdir)subGit.voidsubmoduleClean(boolean recursive)submoduleClean.voidsubmoduleInit()Deprecated.voidsubmoduleSync()Deprecated.SubmoduleUpdateCommandsubmoduleUpdate()Update submodules.voidsubmoduleUpdate(boolean recursive)Run submodule update optionally recursively on all submodules (equivalent ofgit submodule update --recursive.)voidsubmoduleUpdate(boolean recursive, boolean remoteTracking)Run submodule update optionally recursively on all submodules, optionally with remoteTracking submodules (equivalent ofgit submodule update --recursive --remote.)voidsubmoduleUpdate(boolean recursive, boolean remoteTracking, String reference)Run submodule update optionally recursively on all submodules, optionally with remoteTracking, with a specific reference passed to git clone if needing to --init.voidsubmoduleUpdate(boolean recursive, String reference)Run submodule update optionally recursively on all submodules, with a specific reference passed to git clone if needing to --init.voidtag(String name, String message)Create (or update) a tag.booleantagExists(String tagName)tagExists.<T> TwithRepository(RepositoryCallback<T> callable)Runs the computation that requires local access toRepository.protected ObjectwriteReplace()When sent to remote, switch to the proxy.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jenkinsci.plugins.gitclient.GitClient
changelog, checkout, checkout, clone, commit, merge, setAuthor, setCommitter, setCredentials, setProxy, submoduleUpdate, submoduleUpdate, submoduleUpdate, submoduleUpdate, withRepository
-
Methods inherited from interface hudson.plugins.git.IGitAPI
changelog, checkoutBranch
-
-
-
-
Field Detail
-
SSH_CONFIG_PATH
public static final String SSH_CONFIG_PATH
-
workspace
protected final File workspace
-
proxy
protected ProxyConfiguration proxy
-
-
Method Detail
-
buildSshdSessionFactory
public org.eclipse.jgit.transport.sshd.SshdSessionFactory buildSshdSessionFactory(@NonNull HostKeyVerifierFactory hostKeyVerifierFactory)
-
clearCredentials
public void clearCredentials()
clearCredentials.
-
addCredentials
public void addCredentials(String url, com.cloudbees.plugins.credentials.common.StandardCredentials credentials)
Adds credentials to be used against a specific url.- Parameters:
url- the url for the credentials to be used against.credentials- the credentials to use.
-
addDefaultCredentials
public void addDefaultCredentials(com.cloudbees.plugins.credentials.common.StandardCredentials credentials)
Adds credentials to be used when there are not url specific credentials defined.- Parameters:
credentials- the credentials to use.- See Also:
GitClient.addCredentials(String, com.cloudbees.plugins.credentials.common.StandardCredentials)
-
setCredentialsProvider
public void setCredentialsProvider(org.eclipse.jgit.transport.CredentialsProvider prov)
setCredentialsProvider.- Parameters:
prov- aCredentialsProviderobject.
-
getProvider
public SmartCredentialsProvider getProvider()
-
subGit
public GitClient subGit(String subdir)
subGit.- Parameters:
subdir- aStringobject.- Returns:
- a IGitAPI implementation to manage git submodule repository
-
setAuthor
public void setAuthor(String name, String email) throws GitException
Sets the identity of the author for future commits and merge operations.- Parameters:
name- aStringobject.email- aStringobject.- Throws:
GitException- if underlying git operation fails.
-
setCommitter
public void setCommitter(String name, String email) throws GitException
Sets the identity of the committer for future commits and merge operations.- Parameters:
name- aStringobject.email- aStringobject.- Throws:
GitException- if underlying git operation fails.
-
init
public void init() throws GitException, InterruptedExceptioninit.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
checkout
public CheckoutCommand checkout()
checkout.- Returns:
- a
CheckoutCommandobject.
-
add
public void add(String filePattern) throws GitException
add.- Parameters:
filePattern- aStringobject.- Throws:
GitException- if underlying git operation fails.
-
commit
public void commit(String message) throws GitException
commit.- Parameters:
message- aStringobject.- Throws:
GitException- if underlying git operation fails.
-
branch
public void branch(String name) throws GitException
branch.- Parameters:
name- aStringobject.- Throws:
GitException- if underlying git operation fails.
-
deleteBranch
public void deleteBranch(String name) throws GitException
(force) delete a branch.- Parameters:
name- aStringobject.- Throws:
GitException- if underlying git operation fails.
-
getBranches
public Set<Branch> getBranches() throws GitException
getBranches.- Returns:
- a
Setobject. - Throws:
GitException- if underlying git operation fails.
-
getRemoteBranches
public Set<Branch> getRemoteBranches() throws GitException
getRemoteBranches.- Returns:
- a
Setobject. - Throws:
GitException- if underlying git operation fails.
-
getBranchesInternal
public Set<Branch> getBranchesInternal(org.eclipse.jgit.api.ListBranchCommand.ListMode mode) throws GitException
- Throws:
GitException
-
tag
public void tag(String name, String message) throws GitException
Create (or update) a tag. If tag already exist it gets updated (equivalent togit tag --force)- Parameters:
name- aStringobject.message- aStringobject.- Throws:
GitException- if underlying git operation fails.
-
tagExists
public boolean tagExists(String tagName) throws GitException
tagExists.- Parameters:
tagName- aStringobject.- Returns:
- true if tag exists in repository
- Throws:
GitException- if underlying git operation fails.
-
fetch_
public FetchCommand fetch_()
fetch_.- Returns:
- a
FetchCommandobject.
-
fetch
public void fetch(org.eclipse.jgit.transport.URIish url, List<org.eclipse.jgit.transport.RefSpec> refspecs) throws GitException, InterruptedExceptionFetch commits from url which match any of the passed in refspecs. Assumesremote.remoteName.urlhas been set.- Parameters:
url- aURIishobject.refspecs- aListobject.- Throws:
GitException- if any.InterruptedException- if any.
-
fetch
public void fetch(String remoteName, org.eclipse.jgit.transport.RefSpec... refspec) throws GitException
fetch.- Parameters:
remoteName- aStringobject.refspec- aRefSpecobject.- Throws:
GitException- if underlying git operation fails.
-
fetch
public void fetch(String remoteName, org.eclipse.jgit.transport.RefSpec refspec) throws GitException
fetch.- Parameters:
remoteName- aStringobject.refspec- aRefSpecobject.- Throws:
GitException- if underlying git operation fails.
-
ref
public void ref(String refName) throws GitException, InterruptedException
Create (or update) a ref. The ref will reference HEAD (equivalent togit update-ref ... HEAD).- Parameters:
refName- the full name of the ref (e.g. "refs/myref"). Spaces will be replaced with underscores.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
refExists
public boolean refExists(String refName) throws GitException, InterruptedException
Check if a ref exists. Equivalent to comparing the return code ofgit show-refto zero.- Parameters:
refName- the full name of the ref (e.g. "refs/myref"). Spaces will be replaced with underscores.- Returns:
- True if the ref exists, false otherwise.
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
deleteRef
public void deleteRef(String refName) throws GitException, InterruptedException
Deletes a ref. Has no effect if the ref does not exist, equivalent togit update-ref -d.- Parameters:
refName- the full name of the ref (e.g. "refs/myref"). Spaces will be replaced with underscores.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getRefNames
public Set<String> getRefNames(String refPrefix) throws GitException, InterruptedException
List refs with the given prefix. Equivalent togit for-each-ref --format="%(refname)".- Parameters:
refPrefix- the literal prefix any ref returned will have. The empty string implies all.- Returns:
- a set of refs, each beginning with the given prefix. Empty if none.
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getHeadRev
public Map<String,org.eclipse.jgit.lib.ObjectId> getHeadRev(String url) throws GitException, InterruptedException
getHeadRev.- Parameters:
url- aStringobject.- Returns:
- a
Mapobject. - Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getRemoteReferences
public Map<String,org.eclipse.jgit.lib.ObjectId> getRemoteReferences(String url, String pattern, boolean headsOnly, boolean tagsOnly) throws GitException, InterruptedException
List references in a remote repository. Equivalent togit ls-remote [--heads] [--tags] <repository> [<refs>].- Parameters:
url- Remote repository URL.pattern- Only references matching the given pattern are displayed.headsOnly- Limit to only refs/heads.tagsOnly- Limit to only refs/tags. headsOnly and tagsOnly are not mutually exclusive; when both are true, references stored in refs/heads and refs/tags are displayed.- Returns:
- a map of reference names and their commit hashes. Empty if none.
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getRemoteSymbolicReferences
public Map<String,String> getRemoteSymbolicReferences(String url, String pattern) throws GitException, InterruptedException
Description copied from interface:GitClientList symbolic references in a remote repository. Equivalent togit ls-remote --symref <repository> [<refs>]. Note: the response may be empty for multiple reasons- Parameters:
url- Remote repository URL.pattern- Only references matching the given pattern are displayed.- Returns:
- a map of reference names and their underlying references. Empty if none or if the remote does not report symbolic references (i.e. Git 1.8.4 or earlier) or if the client does not support reporting symbolic references (e.g. command line Git prior to 2.8.0).
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getHeadRev
public org.eclipse.jgit.lib.ObjectId getHeadRev(String remoteRepoUrl, String branchSpec) throws GitException
getHeadRev.- Parameters:
remoteRepoUrl- aStringobject.branchSpec- aStringobject.- Returns:
- a
ObjectIdobject. - Throws:
GitException- if underlying git operation fails.
-
getRemoteUrl
public String getRemoteUrl(String name) throws GitException
From a given repository, get a remote's URL- Parameters:
name- The name of the remote (e.g. origin)- Returns:
- a
Stringobject. - Throws:
GitException- if executing the git command fails
-
getRepository
@NonNull public org.eclipse.jgit.lib.Repository getRepository() throws GitExceptiongetRepository.- Returns:
- a
Repositoryobject. - Throws:
GitException- if underlying git operation fails.
-
setRemoteUrl
public void setRemoteUrl(String name, String url) throws GitException
For a given repository, set a remote's URL- 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 fails
-
addRemoteUrl
public void addRemoteUrl(String name, String url) throws GitException
addRemoteUrl.- Parameters:
name- aStringobject.url- aStringobject.- Throws:
GitException- if underlying git operation fails.
-
addNote
public void addNote(String note, String namespace) throws GitException
Adds a new git-note on the current HEAD commit.- Parameters:
note- Content of the note.namespace- If unqualified, interpreted as "refs/notes/NAMESPACE" just like cgit.- Throws:
GitException- if underlying git operation fails.
-
appendNote
public void appendNote(String note, String namespace) throws GitException
Appends to an existing git-note on the current HEAD commit. If a note doesn't exist, it works just likeGitClient.addNote(String, String)- Parameters:
note- Content of the note.namespace- If unqualified, interpreted as "refs/notes/NAMESPACE" just like cgit.- Throws:
GitException- if underlying git operation fails.
-
changelog
public ChangelogCommand changelog()
changelog.- Returns:
- a
ChangelogCommandobject.
-
clean
public void clean(boolean cleanSubmodule) throws GitExceptionclean.- Parameters:
cleanSubmodule- flag to add extra -f- Throws:
GitException- if underlying git operation fails.
-
clean
public void clean() throws GitExceptionclean.- Throws:
GitException- if underlying git operation fails.
-
clone_
public CloneCommand clone_()
clone_.- Returns:
- a
CloneCommandobject.
-
merge
public MergeCommand merge()
merge.- Returns:
- a
MergeCommandobject.
-
init_
public InitCommand init_()
init_.- Returns:
- a
InitCommandobject.
-
rebase
public RebaseCommand rebase()
Description copied from interface:GitClientrebase.- Returns:
- a
RebaseCommandobject.
-
deleteTag
public void deleteTag(String tagName) throws GitException
deleteTag.- Parameters:
tagName- aStringobject.- Throws:
GitException- if underlying git operation fails.
-
getTagMessage
public String getTagMessage(String tagName) throws GitException
getTagMessage.- Parameters:
tagName- aStringobject.- Returns:
- a
Stringobject. - Throws:
GitException- if underlying git operation fails.
-
getSubmodules
public List<IndexEntry> getSubmodules(String treeIsh) throws GitException
Finds all the submodule references in this repository at the specified tree.- Parameters:
treeIsh- aStringobject.- Returns:
- never null.
- Throws:
GitException- if underlying git operation fails.
-
addSubmodule
public void addSubmodule(String remoteURL, String subdir) throws GitException
Create a submodule in subdir child directory for remote repository- Parameters:
remoteURL- aStringobject.subdir- aStringobject.- Throws:
GitException- if underlying git operation fails.
-
getTagNames
public Set<String> getTagNames(String tagPattern) throws GitException
getTagNames.- Parameters:
tagPattern- aStringobject.- Returns:
- a
Setobject. - Throws:
GitException- if underlying git operation fails.
-
getRemoteTagNames
public Set<String> getRemoteTagNames(String tagPattern) throws GitException
getRemoteTagNames.- Parameters:
tagPattern- aStringobject.- Returns:
- a
Setobject. - Throws:
GitException- if underlying git operation fails.
-
hasGitRepo
public boolean hasGitRepo() throws GitExceptionReturns true if the current workspace has a git repository. Does not search parent directories for a repository.- Returns:
- true if this workspace has a git repository
- Throws:
GitException- if underlying git operation fails.
-
hasGitRepo
public boolean hasGitRepo(boolean checkParentDirectories) throws GitExceptionReturns true if the current workspace has a git repository. If checkParentDirectories is true, searches parent directories. If checkParentDirectories is false, checks workspace directory only.- Parameters:
checkParentDirectories- if true, search upwards for a git repository- Returns:
- true if this workspace has a git repository
- Throws:
GitException- if underlying git operation fails.
-
isCommitInRepo
public boolean isCommitInRepo(org.eclipse.jgit.lib.ObjectId commit) throws GitExceptionisCommitInRepo.- Parameters:
commit- aObjectIdobject.- Returns:
- true if commit is in repository
- Throws:
GitException- if underlying git operation fails.
-
prune
public void prune(org.eclipse.jgit.transport.RemoteConfig repository) throws GitExceptionPrune stale remote tracking branches with "git remote prune" on the specified remote.- Parameters:
repository- aRemoteConfigobject.- Throws:
GitException- if underlying git operation fails.
-
push
public PushCommand push()
push.- Returns:
- a
PushCommandobject.
-
revList_
public RevListCommand revList_()
revList_.- Returns:
- a
RevListCommandobject.
-
revListAll
public List<org.eclipse.jgit.lib.ObjectId> revListAll() throws GitException
revListAll.- Returns:
- a
Listobject. - Throws:
GitException- if underlying git operation fails.
-
revList
public List<org.eclipse.jgit.lib.ObjectId> revList(String ref) throws GitException
revList.- Parameters:
ref- aStringobject.- Returns:
- a
Listobject. - Throws:
GitException- if underlying git operation fails.
-
revParse
public org.eclipse.jgit.lib.ObjectId revParse(String revName) throws GitException
Retrieve commit object that is direct child forrevNamerevision reference.- Parameters:
revName- a commit sha1 or tag/branch refname- Returns:
- a
ObjectIdobject. - Throws:
GitException- when no such commit / revName is found in repository.
-
showRevision
public List<String> showRevision(org.eclipse.jgit.lib.ObjectId from, org.eclipse.jgit.lib.ObjectId to) throws GitException
Given a Revision, show it as if it were an entry from git whatchanged, 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().- Parameters:
from- aObjectIdobject.to- aObjectIdobject.- Returns:
- The git whatchanged output, in
rawformat. - Throws:
GitException- if underlying git operation fails.
-
showRevision
public List<String> showRevision(org.eclipse.jgit.lib.ObjectId from, org.eclipse.jgit.lib.ObjectId to, Boolean useRawOutput) throws GitException
Given a Revision, show it as if it were an entry from git whatchanged, so that it can be parsed by GitChangeLogParser.If useRawOutput is true, the '--raw' option will include commit file information to be passed to the 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().- Parameters:
from- aObjectIdobject.to- aObjectIdobject.useRawOutput- a {java.lang.Boolean} object.- Returns:
- The git whatchanged output, in
rawformat. - Throws:
GitException- if underlying git operation fails.
-
submoduleClean
public void submoduleClean(boolean recursive) throws GitExceptionsubmoduleClean.- Parameters:
recursive- a boolean.- Throws:
GitException- if underlying git operation fails.
-
submoduleUpdate
public SubmoduleUpdateCommand submoduleUpdate()
Update submodules.- Returns:
- a
SubmoduleUpdateCommandobject.
-
merge
@Deprecated public void merge(String refSpec) throws GitException, InterruptedException
Deprecated.Merge commits from revspec into the current branch.- Parameters:
refSpec- the revision specification to be merged (for example, origin/main)- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
push
@Deprecated public void push(org.eclipse.jgit.transport.RemoteConfig repository, String refspec) throws GitException, InterruptedException
Deprecated.Push revspec to repository.- Parameters:
repository- git repository to receive commitsrefspec- commits to be pushed- Throws:
GitException- if underlying git operating failsInterruptedException- if interrupted
-
getBranchesContaining
public List<Branch> getBranchesContaining(String revspec) throws GitException, InterruptedException
Find all the branches that include the given commit.- Parameters:
revspec- substring to be searched for branch name- Returns:
- list of branches containing revspec
- Throws:
GitException- on failureInterruptedException- if interrupted
-
getBranchesContaining
public List<Branch> getBranchesContaining(String revspec, boolean allBranches) throws GitException, InterruptedException
Find all the branches that include the given commit. "git branch --contains=X" is a pretty plain traversal. We walk the commit graph until we find the target revision we want. Doing this individually for every branch is too expensive, so we use flags to track multiple branches at once. JGit gives us 24 bits of flags, so we divide up all the branches to batches of 24, then perform a graph walk. For flags to carry correctly over from children to parents, all the children must be visited before we see the parent. This requires a topological sorting order. In addition, we want kind of a "breadth first search" to avoid going down a part of the graph that's not terribly interesting and topo sort helps with that, too (imagine the following commit graph, and compute "git branch --contains=t"; we don't want to visit all the way to c1 before visiting c.) INIT -> c1 -> c2 -> ... long history of commits --+--> c1000 --+--> branch1 | | --> t ------Since we reuse
RevWalk, it'd be nice to flag commits reachable from 't' as uninteresting and keep them across resets, but I'm not sure how to do it.- Parameters:
revspec- commit id to query forallBranches- whether remote branches should be also queried (true) or not (false)- Returns:
- list of branches the specified commit belongs to
- Throws:
GitException- on Git exceptionsInterruptedException- on thread interruption
-
mergeBase
@Deprecated public org.eclipse.jgit.lib.ObjectId mergeBase(org.eclipse.jgit.lib.ObjectId id1, org.eclipse.jgit.lib.ObjectId id2)
Deprecated.mergeBase.- Parameters:
id1- aObjectIdobject.id2- aObjectIdobject.- Returns:
- a
ObjectIdobject.
-
getAllLogEntries
@Deprecated public String getAllLogEntries(String branch)
Deprecated.This method makes no sense, in that it lists all log entries across all refs and yet it takes a meaningless 'branch' parameter. Please do not use this.
-
submoduleInit
@Deprecated public void submoduleInit() throws GitException, InterruptedException
Deprecated.submoduleInit.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
submoduleSync
@Deprecated public void submoduleSync() throws GitException
Deprecated.submoduleSync.- Throws:
GitException- if underlying git operation fails.
-
getSubmoduleUrl
@Deprecated public String getSubmoduleUrl(String name) throws GitException, InterruptedException
Deprecated.Returns URL of the named submodule.- Parameters:
name- submodule name whose URL will be returned- Returns:
- URL of the named submodule
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
setSubmoduleUrl
@Deprecated public void setSubmoduleUrl(String name, String url) throws GitException
Deprecated.Sets URL of the named submodule.- Parameters:
name- submodule name whose URL will be seturl- URL for the named submodule- Throws:
GitException- if underlying git operation fails.
-
setupSubmoduleUrls
@Deprecated public void setupSubmoduleUrls(Revision rev, TaskListener listener) throws GitException
Deprecated.Set up submodule URLs so that they correspond to the remote pertaining to the revision that has been checked out. I don't think anyone is using this method, and I don't think we ever need to implement this. This kind of logic doesn't belong here, as it lacks generality. It should be whoever manipulating Git.- Parameters:
rev- aRevisionobject.listener- aTaskListenerobject.- Throws:
GitException- if underlying git operation fails.
-
fixSubmoduleUrls
@Deprecated public void fixSubmoduleUrls(String remote, TaskListener listener) throws GitException, InterruptedException
Deprecated.fixSubmoduleUrls. I don't think anyone is using this method, and I don't think we ever need to implement this. This kind of logic doesn't belong here, as it lacks generality. It should be whoever manipulating Git.- Parameters:
remote- aStringobject.listener- aTaskListenerobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
describe
public String describe(String tip) throws GitException, InterruptedException
Equivalent of "git-describe --tags". Find a nearby tag (including unannotated ones) and come up with a short identifier to describe the tag. This implementation is based on my reading of the cgit source code at https://github.com/git/git/blob/master/builtin/describe.cThe basic structure of the algorithm is as follows. We walk the commit graph, find tags, and mark commits that are reachable from those tags. The marking uses flags given by JGit, so there's a fairly small upper bound in the number of tags we can keep track of.
As we walk commits, we count commits that each tag doesn't contain. We call it "depth", following the variable name in C Git. As we walk further and find enough tags, we go into wind-down mode and only walk to the point of accurately determining all the depths.
- Parameters:
tip- aStringobject.- Returns:
- a
Stringobject. - Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
lsTree
@Deprecated public List<IndexEntry> lsTree(String treeIsh, boolean recursive) throws GitException, InterruptedException
Deprecated.lsTree.- Parameters:
treeIsh- aStringobject.recursive- a boolean.- Returns:
- a
Listobject. - Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
reset
@Deprecated public void reset(boolean hard) throws GitException, InterruptedException
Deprecated.Reset the contents of the working directory of this repository. Refer to git reset documentation.- Parameters:
hard- reset as though "--hard" were passed to "git reset"- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
isBareRepository
@Deprecated public boolean isBareRepository(String GIT_DIR) throws GitException, InterruptedException
Deprecated.Detect whether a repository at the given path is bare or not.- Parameters:
GIT_DIR- The path to the repository (must be to .git dir).- Returns:
- true if this repository is bare
- Throws:
GitException- on failureInterruptedException- if interrupted
-
getDefaultRemote
@Deprecated public String getDefaultRemote(String _default_) throws GitException, InterruptedException
Deprecated.Returns name of default remote.- Parameters:
_default_- value to return if no remote is defined in this repository- Returns:
- name of default remote
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
setRemoteUrl
@Deprecated public void setRemoteUrl(String name, String url, String GIT_DIR) throws GitException, InterruptedException
Deprecated.Set remote repository name and URL.- Parameters:
name- name for the remote repository, for example, "origin"url- URL for the remote repository, for example https://github.com/jenkinsci/git-client-plugin.gitGIT_DIR- directory containing git repository- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getRemoteUrl
@Deprecated public String getRemoteUrl(String name, String GIT_DIR) throws GitException, InterruptedException
Deprecated.Returns URL of remote name in repository GIT_DIR.- Parameters:
name- name for the remote repository, for example, "origin"GIT_DIR- directory containing git repository- Returns:
- URL of remote "name" in repository GIT_DIR.
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getTags
public Set<GitObject> getTags() throws GitException
Return name and object ID of all tags in current repository.- Returns:
- set of tags in current repository
- Throws:
GitException- on Git exceptions
-
maintenance
public boolean maintenance(String task)
Description copied from interface:GitClientExecutes git maintenance commands based on the git version.- Parameters:
task- aStringobject. i.e (prefetch/gc/commit-graph/incremental-repack/loose-objects)- Returns:
- Boolean if maintenance has been executed or not.
-
config
public void config(GitClient.ConfigLevel configLevel, String key, String value) throws GitException, InterruptedException
Execute git config at the specified configuration level. If value is null, the key will be removed from the configuration.- Parameters:
configLevel- configuration level that will be modified. If null, thenGitClient.ConfigLevel.LOCALwill be used.key- configuration section expressed assection[.subsection].namevalue- configuration value. If null, the key will be removed from the configuration (unset)- Throws:
GitException- on Git exceptionInterruptedException- on thread interruption
-
isBareRepository
public boolean isBareRepository() throws GitException, InterruptedExceptionisBareRepository.- Specified by:
isBareRepositoryin interfaceIGitAPI- Returns:
- true if this repository is a bare repository
- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getHostKeyFactory
public HostKeyVerifierFactory getHostKeyFactory()
-
setHostKeyFactory
public void setHostKeyFactory(HostKeyVerifierFactory verifier)
-
hasGitModules
@Deprecated public boolean hasGitModules(String treeIsh) throws GitException
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:
GitClient.hasGitModules()
-
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 InterruptedException
Deprecated.Retrieve commits from RemoteConfig.- Specified by:
fetchin interfaceIGitAPI- Parameters:
remoteRepository- remote configuration from which refs will be retrieved- Throws:
InterruptedException- if interrupted.
-
fetch
@Deprecated public void fetch() throws GitException, InterruptedException
Deprecated.fetch.- Specified by:
fetchin interfaceIGitAPI- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
reset
@Deprecated public void reset() throws GitException, InterruptedException
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.
-
push
@Deprecated public void push(String remoteName, String refspec) throws GitException, InterruptedException
Deprecated.push.- Specified by:
pushin interfaceGitClient- Parameters:
remoteName- aStringobject.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 public List<String> showRevision(Revision r) throws GitException, InterruptedException
Deprecated.showRevision.- Specified by:
showRevisionin interfaceIGitAPI- Parameters:
r- aRevisionobject.- Returns:
- a
Listobject. - Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
getTagsOnCommit
@Deprecated public List<Tag> getTagsOnCommit(String revName) throws GitException, IOException
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
public final List<IndexEntry> lsTree(String treeIsh) throws GitException, InterruptedException
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
protected Object writeReplace() throws ObjectStreamException
When sent to remote, switch to the proxy.- Returns:
- a
Objectobject. - Throws:
ObjectStreamException- if current channel is null
-
hasGitModules
public boolean hasGitModules() throws GitExceptionhasGitModules.- 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 whatchanged, 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 whatchanged output, in
rawformat. - Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
extractBranchNameFromBranchSpec
protected String extractBranchNameFromBranchSpec(String branchSpec)
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 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 interrupted
-
commit
public void commit(String message, org.eclipse.jgit.lib.PersonIdent author, org.eclipse.jgit.lib.PersonIdent committer) throws GitException, InterruptedException
commit.- Specified by:
commitin interfaceGitClient- Parameters:
message- aStringobject.author- aPersonIdentobject.committer- aPersonIdentobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
setAuthor
public void setAuthor(org.eclipse.jgit.lib.PersonIdent p)
setAuthor.
-
setCommitter
public void setCommitter(org.eclipse.jgit.lib.PersonIdent p)
setCommitter.- Specified by:
setCommitterin interfaceGitClient- Parameters:
p- aPersonIdentobject.
-
changelog
public void changelog(String revFrom, String revTo, OutputStream outputStream) throws GitException, InterruptedException
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.
-
checkout
public void checkout(String commit) throws GitException, InterruptedException
Checks out the specified commit/tag/branch into the workspace. (equivalent ofgit checkout branch.)- Specified by:
checkoutin interfaceGitClient- Parameters:
commit- A git object references expression (either a sha1, tag or branch)- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
checkout
public void checkout(String ref, String branch) throws GitException, InterruptedException
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.
-
checkoutBranch
public void checkoutBranch(String branch, String ref) throws GitException, InterruptedException
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
public void merge(org.eclipse.jgit.lib.ObjectId rev) throws GitException, InterruptedExceptionmerge.- Specified by:
mergein interfaceGitClient- Parameters:
rev- aObjectIdobject.- Throws:
GitException- if underlying git operation fails.InterruptedException- if interrupted.
-
remoteProxyFor
protected org.jenkinsci.plugins.gitclient.RemoteGitImpl remoteProxyFor(GitClient proxy)
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
public void setProxy(ProxyConfiguration proxy)
setProxy.- Specified by:
setProxyin interfaceGitClient- Parameters:
proxy- aProxyConfigurationobject.
-
submoduleUpdate
public void submoduleUpdate(boolean recursive) throws GitException, InterruptedExceptionRun 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
public void submoduleUpdate(boolean recursive, String reference) throws GitException, InterruptedExceptionRun 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
public void submoduleUpdate(boolean recursive, boolean remoteTracking) throws GitException, InterruptedExceptionRun 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
public void submoduleUpdate(boolean recursive, boolean remoteTracking, String reference) throws GitException, InterruptedExceptionRun 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.
-
-