Browse Source

Merge "Fix broken git prefix detection"

stable-0.12
Shawn Pearce 14 years ago committed by Code Review
parent
commit
bc42a780eb
  1. 11
      org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
  2. 8
      org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java

11
org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java

@ -286,7 +286,9 @@ public abstract class FS {
}
}
} catch (IOException e) {
// ignore
if (SystemReader.getInstance().getProperty("jgit.fs.debug") != null)
System.err.println(e);
// Ignore error (but report)
}
return null;
}
@ -295,7 +297,12 @@ public abstract class FS {
public File gitPrefix() {
Holder<File> p = gitPrefix;
if (p == null) {
p = new Holder<File>(discoverGitPrefix());
String overrideGitPrefix = SystemReader.getInstance().getProperty(
"jgit.gitprefix");
if (overrideGitPrefix != null)
p = new Holder<File>(new File(overrideGitPrefix));
else
p = new Holder<File>(discoverGitPrefix());
gitPrefix = p;
}
return p.value;

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

@ -106,8 +106,12 @@ class FS_Win32 extends FS {
String w = readPipe(userHome(), //
new String[] { "bash", "--login", "-c", "which git" }, //
Charset.defaultCharset().name());
if (w != null)
return new File(w).getParentFile().getParentFile();
if (w != null) {
// 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;
}

Loading…
Cancel
Save