Browse Source

FS_Win32: Avoid an IOException on Windows if bash is not in PATH

Change-Id: I3145f74ecee9f5b368e7f4b9fd7cb906f407eff5
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.1
Sebastian Schuberth 10 years ago committed by Matthias Sohn
parent
commit
ec6ec3b10f
  1. 10
      org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java

10
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java

@ -111,10 +111,10 @@ public class FS_Win32 extends FS {
if (gitExe != null)
return resolveGrandparentFile(gitExe);
// This isn't likely to work, if bash is in $PATH, git should
// also be in $PATH. But its worth trying.
//
String w = readPipe(userHome(), //
if (searchPath(path, "bash.exe") != null) { //$NON-NLS-1$
// This isn't likely to work, but its worth trying:
// If bash is in $PATH, git should also be in $PATH.
String w = readPipe(userHome(),
new String[] { "bash", "--login", "-c", "which git" }, // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
Charset.defaultCharset().name());
if (w != null) {
@ -123,6 +123,8 @@ public class FS_Win32 extends FS {
if (gitExe != null)
return resolveGrandparentFile(gitExe);
}
}
return null;
}

Loading…
Cancel
Save