Package jenkins.plugins.git
Class GitToolChooser
java.lang.Object
jenkins.plugins.git.GitToolChooser
A class which allows Git Plugin to choose a git implementation by estimating the size of a repository from a distance
without requiring a local checkout.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Other plugins can estimate the size of repository using this extension point The size is assumed to be in KiBs -
Constructor Summary
ConstructorsConstructorDescriptionGitToolChooser
(String remoteName, Item projectContext, String credentialsId, hudson.plugins.git.GitTool gitExe, Node n, TaskListener listener, Boolean useJGit) Instantiate class using the remote name. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Clear the cache of repository sizes.Recommend git tool to be used by the git clientstatic void
putRepositorySizeCache
(String repoURL, long repoSize) Insert an entry into the cache of repository sizes.hudson.plugins.git.GitTool
recommendGitToolOnAgent
(hudson.plugins.git.GitTool userChoice)
-
Constructor Details
-
GitToolChooser
public GitToolChooser(String remoteName, Item projectContext, String credentialsId, hudson.plugins.git.GitTool gitExe, Node n, TaskListener listener, Boolean useJGit) throws IOException, InterruptedException Instantiate class using the remote name. It looks for a cached .git directory first, calculates the size if it is found else checks if the extension point has been implemented and asks for the size.- Parameters:
remoteName
- the repository urlprojectContext
- the context where repository size is being estimatedcredentialsId
- credential used to access the repository or null if no credential is requiredgitExe
- Git tool ('git', 'jgit', 'jgitapache') to be used as the default tooln
- A Jenkins agent used to check validity of git installationlistener
- TaskListener required by GitUtils.resolveGitTool()useJGit
- if true the JGit is allowed as an implementation- Throws:
IOException
- on errorInterruptedException
- on error
-
-
Method Details
-
recommendGitToolOnAgent
public hudson.plugins.git.GitTool recommendGitToolOnAgent(hudson.plugins.git.GitTool userChoice) -
getGitTool
Recommend git tool to be used by the git client- Returns:
- git implementation recommendation in the form of a string
-
clearRepositorySizeCache
public static void clearRepositorySizeCache()Clear the cache of repository sizes. -
putRepositorySizeCache
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void putRepositorySizeCache(String repoURL, long repoSize) Insert an entry into the cache of repository sizes. For testing only - not to be used outside the git plugin.- Parameters:
repoURL
- repository URL to be added as a cache keyrepoSize
- repository size in kilobytes
-