Class CloneOption
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<GitSCMExtension>
-
- hudson.plugins.git.extensions.GitSCMExtension
-
- hudson.plugins.git.extensions.impl.CloneOption
-
- All Implemented Interfaces:
Describable<GitSCMExtension>
public class CloneOption extends GitSCMExtension
- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CloneOption.DescriptorImpl
-
Constructor Summary
Constructors Constructor Description CloneOption(boolean shallow, boolean noTags, String reference, Integer timeout)
CloneOption(boolean shallow, String reference, Integer timeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
decorateCloneCommand(GitSCM scm, Run<?,?> build, org.jenkinsci.plugins.gitclient.GitClient git, TaskListener listener, org.jenkinsci.plugins.gitclient.CloneCommand cmd)
Called before aCloneCommand
is executed to allow extensions to alter its behaviour.void
decorateFetchCommand(GitSCM scm, org.jenkinsci.plugins.gitclient.GitClient git, TaskListener listener, org.jenkinsci.plugins.gitclient.FetchCommand cmd)
Deprecated.void
determineSupportForJGit(GitSCM scm, org.jenkinsci.plugins.gitclient.UnsupportedCommand cmd)
Called when support of JGit for a particular or multiple extensions is to be determinedboolean
equals(Object o)
Integer
getDepth()
String
getReference()
GitClientType
getRequiredClient()
Let extension declare required GitClient implementation.Integer
getTimeout()
int
hashCode()
boolean
isHonorRefspec()
Returns true if the job should clone only the items which match the refspec, or if all references are cloned, then the refspec should be used in later operations.boolean
isNoTags()
boolean
isShallow()
void
setDepth(Integer depth)
void
setHonorRefspec(boolean honorRefspec)
This setting allows the job definition to control whether the refspec will be honored during the first clone or not.String
toString()
-
Methods inherited from class hudson.plugins.git.extensions.GitSCMExtension
beforeCheckout, beforeCheckout, decorate, decorateCheckoutCommand, decorateCheckoutCommand, decorateCloneCommand, decorateFetchCommand, decorateMergeCommand, decorateMergeCommand, decorateRevisionToBuild, decorateRevisionToBuild, enableMultipleRevisionDetection, getDescriptor, getWorkingDirectory, getWorkingDirectory, isRevExcluded, onCheckoutCompleted, onCheckoutCompleted, onClean, populateEnvironmentVariables, requiresWorkspaceForPolling
-
-
-
-
Method Detail
-
isShallow
public boolean isShallow()
-
isNoTags
public boolean isNoTags()
-
setHonorRefspec
@DataBoundSetter public void setHonorRefspec(boolean honorRefspec)
This setting allows the job definition to control whether the refspec will be honored during the first clone or not. Prior to git plugin 2.5.1, JENKINS-31393 caused the user provided refspec to be ignored during the initial clone. It was honored in later fetch operations, but not in the first clone. That meant the initial clone had to fetch all the branches and their references from the remote repository, even if those branches were later ignored due to the refspec. The fix for JENKINS-31393 exposed JENKINS-36507 which suggests that the Gerrit Plugin assumes all references are fetched, even though it only passes the refspec for one branch.- Parameters:
honorRefspec
- true if refspec should be honored on clone
-
isHonorRefspec
public boolean isHonorRefspec()
Returns true if the job should clone only the items which match the refspec, or if all references are cloned, then the refspec should be used in later operations. Prior to git plugin 2.5.1, JENKINS-31393 caused the user provided refspec to be ignored during the initial clone. It was honored in later fetch operations, but not in the first clone. That meant the initial clone had to fetch all the branches and their references from the remote repository, even if those branches were later ignored due to the refspec. The fix for JENKINS-31393 exposed JENKINS-36507 which seems to show that the Gerrit Plugin assumes all references are fetched, even though it only passes the refspec for one branch.- Returns:
- true if initial clone will honor the user defined refspec
-
getReference
public String getReference()
-
getTimeout
public Integer getTimeout()
-
setDepth
@DataBoundSetter public void setDepth(Integer depth)
-
getDepth
public Integer getDepth()
-
decorateCloneCommand
public void decorateCloneCommand(GitSCM scm, Run<?,?> build, org.jenkinsci.plugins.gitclient.GitClient git, TaskListener listener, org.jenkinsci.plugins.gitclient.CloneCommand cmd) throws IOException, InterruptedException, hudson.plugins.git.GitException
Called before aCloneCommand
is executed to allow extensions to alter its behaviour.- Overrides:
decorateCloneCommand
in classGitSCMExtension
- Parameters:
scm
- GitSCM objectbuild
- run contextgit
- GitClientlistener
- build logcmd
- clone command to be decorated- Throws:
IOException
- on input or output errorInterruptedException
- when interruptedhudson.plugins.git.GitException
- on git error
-
decorateFetchCommand
@Deprecated public void decorateFetchCommand(GitSCM scm, org.jenkinsci.plugins.gitclient.GitClient git, TaskListener listener, org.jenkinsci.plugins.gitclient.FetchCommand cmd) throws IOException, InterruptedException, hudson.plugins.git.GitException
Deprecated.Called before aFetchCommand
is executed to allow extensions to alter its behaviour.- Overrides:
decorateFetchCommand
in classGitSCMExtension
- Parameters:
scm
- GitSCM objectgit
- GitClientlistener
- build logcmd
- fetch command to be decorated- Throws:
IOException
- on input or output errorInterruptedException
- when interruptedhudson.plugins.git.GitException
- on git error
-
determineSupportForJGit
public void determineSupportForJGit(GitSCM scm, @NonNull org.jenkinsci.plugins.gitclient.UnsupportedCommand cmd)
Description copied from class:GitSCMExtension
Called when support of JGit for a particular or multiple extensions is to be determined- Overrides:
determineSupportForJGit
in classGitSCMExtension
- Parameters:
scm
- GitSCM objectcmd
- UnsupportedCommand object
-
getRequiredClient
public GitClientType getRequiredClient()
Let extension declare required GitClient implementation. git-plugin will then detect conflicts, and fallback to globally configured default git client- Overrides:
getRequiredClient
in classGitSCMExtension
- Returns:
- git client type required for this extension
-
-