Class GitSCM

    • Method Detail

      • isCreateAccountBasedOnEmail

        public boolean isCreateAccountBasedOnEmail()
      • isUseExistingAccountWithSameEmail

        public boolean isUseExistingAccountWithSameEmail()
      • isHideCredentials

        public boolean isHideCredentials()
      • isAllowSecondFetch

        public boolean isAllowSecondFetch()
      • isDisableGitToolChooser

        public boolean isDisableGitToolChooser()
      • isAddGitTagAction

        public boolean isAddGitTagAction()
      • getParamLocalBranch

        public String getParamLocalBranch​(Run<?,​?> build,
                                          TaskListener listener)
                                   throws IOException,
                                          InterruptedException
        Gets the parameter-expanded effective value in the context of the current build.
        Parameters:
        build - run whose local branch name is returned
        listener - build log
        Returns:
        parameter-expanded local branch name in build.
        Throws:
        IOException - on input or output error
        InterruptedException - when interrupted
      • getParamExpandedRepos

        public List<org.eclipse.jgit.transport.RemoteConfig> getParamExpandedRepos​(Run<?,​?> build,
                                                                                   TaskListener listener)
                                                                            throws IOException,
                                                                                   InterruptedException
        Expand parameters in remoteRepositories with the parameter values provided in the given build and return them.
        Parameters:
        build - run whose local branch name is returned
        listener - build log
        Returns:
        can be empty but never null.
        Throws:
        IOException - on input or output error
        InterruptedException - when interrupted
      • getParamExpandedRepo

        public org.eclipse.jgit.transport.RemoteConfig getParamExpandedRepo​(EnvVars env,
                                                                            org.eclipse.jgit.transport.RemoteConfig remoteRepository)
        Expand Parameters in the supplied remote repository with the parameter values provided in the given environment variables
        Parameters:
        env - Environment variables with parameter values
        remoteRepository - Remote repository with parameters
        Returns:
        remote repository with expanded parameters
      • getRepositoryByName

        public org.eclipse.jgit.transport.RemoteConfig getRepositoryByName​(String repoName)
      • getRepositories

        public List<org.eclipse.jgit.transport.RemoteConfig> getRepositories()
      • deriveLocalBranchName

        public String deriveLocalBranchName​(String remoteBranchName)
        Derives a local branch name from the remote branch name by removing the name of the remote from the remote branch name.

        Ex. origin/master becomes master

        Cycles through the list of user remotes looking for a match allowing user to configure an alternate (not origin) name for the remote.

        Parameters:
        remoteBranchName - branch name whose remote repository name will be removed
        Returns:
        a local branch name derived by stripping the remote repository name from the remoteBranchName parameter. If a matching remote is not found, the original remoteBranchName will be returned.
      • getGitTool

        @CheckForNull
        public String getGitTool()
      • getParameterString

        @NonNull
        public static String getParameterString​(@CheckForNull
                                                String original,
                                                @NonNull
                                                EnvVars env)
      • createClient

        @NonNull
        public org.jenkinsci.plugins.gitclient.GitClient createClient​(TaskListener listener,
                                                                      EnvVars environment,
                                                                      @NonNull
                                                                      Run<?,​?> build,
                                                                      FilePath workspace)
                                                               throws IOException,
                                                                      InterruptedException
        Allows Builders and Publishers to access a configured GitClient object to perform additional git operations.
        Parameters:
        listener - build log
        environment - environment variables to be used
        build - run context for the returned GitClient
        workspace - client workspace
        Returns:
        git client for additional git operations
        Throws:
        IOException - on input or output error
        InterruptedException - when interrupted
      • createClient

        @NonNull
        public org.jenkinsci.plugins.gitclient.GitClient createClient​(TaskListener listener,
                                                                      EnvVars environment,
                                                                      @NonNull
                                                                      Run<?,​?> build,
                                                                      FilePath workspace,
                                                                      org.jenkinsci.plugins.gitclient.UnsupportedCommand postBuildUnsupportedCommand)
                                                               throws IOException,
                                                                      InterruptedException
        Allows Publisher and other post build actions to access a configured GitClient. The post build action can use the postBuildUnsupportedCommand argument to control the selection of a git tool by GitToolChooser.
        Parameters:
        listener - build log
        environment - environment variables to be used
        build - run context for the returned GitClient
        workspace - client workspace
        postBuildUnsupportedCommand - passed by caller to control choice of git tool by GitTooChooser
        Returns:
        git client for additional git operations
        Throws:
        IOException - on input or output error
        InterruptedException - when interrupted
      • resolveGitTool

        @CheckForNull
        public hudson.plugins.git.GitTool resolveGitTool​(TaskListener listener)
      • getGitExe

        public String getGitExe​(Node builtOn,
                                EnvVars env,
                                TaskListener listener)
        Exposing so that we can get this from GitPublisher.
        Parameters:
        builtOn - node where build was performed
        env - environment variables used in the build
        listener - build log
        Returns:
        git exe for builtOn node, often "Default" or "jgit"
      • getGitTool

        public hudson.plugins.git.GitTool getGitTool​(Node builtOn,
                                                     EnvVars env,
                                                     TaskListener listener)
      • isDoGenerateSubmoduleConfigurations

        @Deprecated
        public boolean isDoGenerateSubmoduleConfigurations()
        Deprecated.
      • getBuildData

        @Deprecated
        public BuildData getBuildData​(Run build,
                                      boolean clone)
        Deprecated.
        Parameters:
        build - run whose build data is returned
        clone - true if returned build data should be copied rather than referenced
        Returns:
        build data for build run
      • copyBuildData

        public BuildData copyBuildData​(Run build)
        Like getBuildData(Run), but copy the data into a new object, which is used as the first step for updating the data for the next build.
        Parameters:
        build - run whose BuildData is returned
        Returns:
        copy of build data for build
      • getBuildData

        @CheckForNull
        public BuildData getBuildData​(Run build)
        Find the build log (BuildData) recorded with the last build that completed. BuildData may not be recorded if an exception occurs in the plugin logic.
        Parameters:
        build - run whose build data is returned
        Returns:
        the last recorded build data
      • workingDirectory

        protected FilePath workingDirectory​(Job<?,​?> context,
                                            FilePath workspace,
                                            EnvVars environment,
                                            TaskListener listener)
                                     throws IOException,
                                            InterruptedException
        Given the workspace, gets the working directory, which will be the workspace if no relative target dir is specified. Otherwise, it'll be "workspace/relativeTargetDir".
        Parameters:
        context - job context for working directory
        workspace - initial FilePath of job workspace
        environment - environment variables used in job context
        listener - build log
        Returns:
        working directory or null if workspace is null
        Throws:
        IOException - on input or output error
        InterruptedException - when interrupted
      • setDoGenerateSubmoduleConfigurations

        @DataBoundSetter
        public void setDoGenerateSubmoduleConfigurations​(boolean ignoredValue)
        Data bound setter for doGenerateSubmoduleConfigurations that intentionally ignores the value passed by the caller. Submodule configuration generation was untested and unlikely to work prior to git plugin 4.6.0. It was removed from git plugin 4.6.0 to improve the experience for Pipeline Syntax users.
        Parameters:
        ignoredValue - ignored because submodule configuration generation is no longer supported
      • getDoGenerateSubmoduleConfigurations

        @Deprecated
        public boolean getDoGenerateSubmoduleConfigurations()
        Deprecated.
        Returns false, the constant value of doGenerateSubmoduleConfigurations.
        Returns:
        false, the constant value of doGenerateSubmoduleConfigurations.