Merge "Fix broken git prefix detection"
This commit is contained in:
commit
bc42a780eb
|
@ -286,7 +286,9 @@ protected static String readPipe(File dir, String[] command, String encoding) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// ignore
|
if (SystemReader.getInstance().getProperty("jgit.fs.debug") != null)
|
||||||
|
System.err.println(e);
|
||||||
|
// Ignore error (but report)
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -295,6 +297,11 @@ protected static String readPipe(File dir, String[] command, String encoding) {
|
||||||
public File gitPrefix() {
|
public File gitPrefix() {
|
||||||
Holder<File> p = gitPrefix;
|
Holder<File> p = gitPrefix;
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
|
String overrideGitPrefix = SystemReader.getInstance().getProperty(
|
||||||
|
"jgit.gitprefix");
|
||||||
|
if (overrideGitPrefix != null)
|
||||||
|
p = new Holder<File>(new File(overrideGitPrefix));
|
||||||
|
else
|
||||||
p = new Holder<File>(discoverGitPrefix());
|
p = new Holder<File>(discoverGitPrefix());
|
||||||
gitPrefix = p;
|
gitPrefix = p;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,8 +106,12 @@ protected File discoverGitPrefix() {
|
||||||
String w = readPipe(userHome(), //
|
String w = readPipe(userHome(), //
|
||||||
new String[] { "bash", "--login", "-c", "which git" }, //
|
new String[] { "bash", "--login", "-c", "which git" }, //
|
||||||
Charset.defaultCharset().name());
|
Charset.defaultCharset().name());
|
||||||
if (w != null)
|
if (w != null) {
|
||||||
return new File(w).getParentFile().getParentFile();
|
// The path may be in cygwin/msys notation so resolve it right away
|
||||||
|
gitExe = resolve(null, w);
|
||||||
|
if (gitExe != null)
|
||||||
|
return gitExe.getParentFile().getParentFile();
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue