Class CloneOption

    • Constructor Detail

      • CloneOption

        public CloneOption​(boolean shallow,
                           String reference,
                           Integer timeout)
      • CloneOption

        @DataBoundConstructor
        public CloneOption​(boolean shallow,
                           boolean noTags,
                           String reference,
                           Integer timeout)
    • 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 a CloneCommand is executed to allow extensions to alter its behaviour.
        Overrides:
        decorateCloneCommand in class GitSCMExtension
        Parameters:
        scm - GitSCM object
        build - run context
        git - GitClient
        listener - build log
        cmd - clone command to be decorated
        Throws:
        IOException - on input or output error
        InterruptedException - when interrupted
        hudson.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 a FetchCommand is executed to allow extensions to alter its behaviour.
        Overrides:
        decorateFetchCommand in class GitSCMExtension
        Parameters:
        scm - GitSCM object
        git - GitClient
        listener - build log
        cmd - fetch command to be decorated
        Throws:
        IOException - on input or output error
        InterruptedException - when interrupted
        hudson.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 class GitSCMExtension
        Parameters:
        scm - GitSCM object
        cmd - 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 class GitSCMExtension
        Returns:
        git client type required for this extension
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object