Skip to content

Commit

Permalink
[JENKINS-17013] use default git installation if none matches
Browse files Browse the repository at this point in the history
  • Loading branch information
ndeloof committed Mar 12, 2013
1 parent 0789410 commit 9ed0f0b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/hudson/plugins/git/GitSCM.java
Expand Up @@ -816,9 +816,14 @@ private RemoteConfig newRemoteConfig(String name, String refUrl, RefSpec refSpec
}
}

public GitTool resolveGitTool() {
public GitTool resolveGitTool(TaskListener listener) {
if (gitTool == null) return GitTool.getDefaultInstallation();
return Hudson.getInstance().getDescriptorByType(GitTool.DescriptorImpl.class).getInstallation(gitTool);
GitTool git = Hudson.getInstance().getDescriptorByType(GitTool.DescriptorImpl.class).getInstallation(gitTool);
if (git == null) {
listener.getLogger().println("selected Git installation does not exists. Using Default");
git = GitTool.getDefaultInstallation();
}
return git;
}

public String getGitExe(Node builtOn, TaskListener listener) {
Expand All @@ -829,7 +834,7 @@ public String getGitExe(Node builtOn, TaskListener listener) {
* Exposing so that we can get this from GitPublisher.
*/
public String getGitExe(Node builtOn, EnvVars env, TaskListener listener) {
GitTool tool = resolveGitTool();
GitTool tool = resolveGitTool(listener);
if (builtOn != null) {
try {
tool = tool.forNode(builtOn, listener);
Expand Down

0 comments on commit 9ed0f0b

Please sign in to comment.