Skip to content
Permalink
Browse files
Add mingw64 dir to ssh location guesser - windows git 2.8.0
Implement ssh executable test in CliGitAPIImplTest, not applicable
to JGit.

May help [JENKINS-30045], [JENKINS-28943], [JENKINS-25297], & [JENKINS-21806]
  • Loading branch information
Mark Waite authored and MarkEWaite committed Jun 6, 2016
1 parent 651205a commit 2a2c6d339dcda8556b267f8a3584a5dd762be387
@@ -1643,6 +1643,14 @@ private File getSSHExeFromGitExeParentDir(String userGitExe) {
if (sshexe != null && sshexe.exists()) {
return sshexe;
}
sshexe = getSSHExeFromGitExeParentDir(gitPath.replace("/mingw64/", "/").replace("\\mingw64\\", "\\"));
if (sshexe != null && sshexe.exists()) {
return sshexe;
}
sshexe = getSSHExeFromGitExeParentDir(gitPath.replace("/mingw64/bin/", "/usr/bin/").replace("\\mingw64\\bin\\", "\\usr\\bin\\"));
if (sshexe != null && sshexe.exists()) {
return sshexe;
}
}

throw new RuntimeException("ssh executable not found. The git plugin only supports official git client http://git-scm.com/download/win");
@@ -3,6 +3,8 @@
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import static junit.framework.TestCase.assertTrue;
import org.apache.commons.lang.SystemUtils;

/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
@@ -246,6 +248,16 @@ public void test_git_version_ubuntu_14_04_ppa_2_3_5() {
doTest("git version 2.3.5", versions);
}

/* Not implemented in JGit because it is not needed there */
public void test_git_ssh_executable_found_on_windows() throws Exception {
setTimeoutVisibleInCurrentTest(false);
if (!SystemUtils.IS_OS_WINDOWS) {
return;
}

assertTrue("ssh.exe not found", w.cgit().getSSHExecutable().exists());
}

@Override
protected String getRemoteBranchPrefix() {
return "remotes/";
@@ -265,7 +265,7 @@ public IGitAPI igit() {
}
}

private WorkingArea w;
protected WorkingArea w;

WorkingArea clone(String src) throws Exception {
WorkingArea x = new WorkingArea();
@@ -3890,17 +3890,6 @@ public void test_longpaths_disabled() throws Exception {
assert_longpaths(w, false);
}

@NotImplementedInJGit
/* Not implemented in JGit because it is not needed there */
public void test_git_ssh_executable_found_on_windows() throws Exception {
setTimeoutVisibleInCurrentTest(false);
if (!SystemUtils.IS_OS_WINDOWS) {
return;
}

assertTrue("ssh.exe not found", w.cgit().getSSHExecutable().exists());
}

/**
* Returns the prefix for the remote branches while querying them.
* @return remote branch pregix, for example, "remotes/"

0 comments on commit 2a2c6d3

Please sign in to comment.