Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Commit

Permalink
Merge commit '3f1eeaedb98b4632cfa4e0c5ddb27dd4c73382de'
Browse files Browse the repository at this point in the history
  • Loading branch information
kohsuke committed Apr 15, 2010
2 parents 69299bf + 3f1eeae commit 70a9dba
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
22 changes: 15 additions & 7 deletions src/main/java/hudson/plugins/git/GitSCM.java
Original file line number Diff line number Diff line change
Expand Up @@ -885,28 +885,36 @@ public boolean configure(StaplerRequest req) throws FormException {
return true;
}

public void doGitExeCheck(StaplerRequest req, StaplerResponse rsp)
public void doGitExeCheck(final StaplerRequest req, StaplerResponse rsp)
throws IOException, ServletException {
new FormFieldValidator.Executable(req, rsp) {
protected void checkExecutable(File exe) throws IOException,
ServletException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
String gitExe = req.getParameter("value");
Proc proc = Hudson.getInstance().createLauncher(
TaskListener.NULL).launch(
new String[] { getGitExe(), "--version" },
new String[] { gitExe, "--version" },
new String[0], baos, null);
proc.join();
String versionString = baos.toString();
if (!versionString.startsWith("git")) {
error("Version string didn't start with \"git\" as expected, output was :\n"
+ versionString);
} else {
ok();
}

// String result = baos.toString();

ok();

} catch (InterruptedException e) {
error("Unable to check git version");
error("Unable to check git version, reason: \n" + e.getLocalizedMessage());
} catch (RuntimeException e) {
error("Unable to check git version");
}
error("Unable to check git version, reason: \n" + e.getLocalizedMessage());
} catch (IOException e) {
error("Unable to check git version, reason: \n" + e.getLocalizedMessage());
}

}
}.process();
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/hudson/plugins/git/GitSCM/global.jelly
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:section title="Git">
<f:entry title="Git executable" help="/plugin/git/help/gitExe.html">
<f:textbox name="git.gitExe" value="${descriptor.gitExe}"
checkUrl="'${rootURL}/scm/GitSCM/gitExeCheck?value='+escape(this.value)" />
</f:entry>
<f:entry title="Git executable" help="/plugin/git/help-gitExe.html">
<f:textbox name="git.gitExe" value="${descriptor.gitExe}"
checkUrl="'${rootURL}/scm/GitSCM/gitExeCheck?value='+escape(this.value)" />
</f:entry>
</f:section>
</j:jelly>
4 changes: 4 additions & 0 deletions src/main/webapp/help-gitExe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
Specify the path to your git executable. Hudson will use PATH -variable when executing command, so "git" will usually
be enough
</div>

0 comments on commit 70a9dba

Please sign in to comment.