]> source.dussan.org Git - jgit.git/commitdiff
Equalize discoverGitPrefix() implementations between POSIX and Win32 41/48141/3
authorSebastian Schuberth <sschuberth@gmail.com>
Tue, 19 May 2015 07:35:18 +0000 (09:35 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Thu, 21 May 2015 21:32:07 +0000 (23:32 +0200)
Change-Id: I936df151890d4bba9079d79c65b75a69c209523b
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java

index 667b969796d377980a4bdb2c36d822995a397976..e2f9bb8264680e5345175325f15a76baff7c9acb 100644 (file)
@@ -141,16 +141,18 @@ public class FS_POSIX extends FS {
                        return resolveGrandparentFile(gitExe);
 
                if (SystemReader.getInstance().isMacOS()) {
-                       // On MacOSX, PATH is shorter when Eclipse is launched from the
-                       // Finder than from a terminal. Therefore try to launch bash as a
-                       // login shell and search using that.
-                       //
-                       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 || w.length() == 0)
-                               return null;
-                       return resolveGrandparentFile(new File(w));
+                       if (searchPath(path, "bash") != null) { //$NON-NLS-1$
+                               // On MacOSX, PATH is shorter when Eclipse is launched from the
+                               // Finder than from a terminal. Therefore try to launch bash as a
+                               // login shell and search using that.
+                               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 || w.length() == 0)
+                                       return null;
+                               gitExe = new File(w);
+                               return resolveGrandparentFile(gitExe);
+                       }
                }
 
                return null;
index 6e0c5e85fb176b341f4362f2f5d68782ec421c59..5282733dd8cf27db9dd575064f5a0868a114cb6c 100644 (file)
@@ -117,12 +117,12 @@ public class FS_Win32 extends FS {
                        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) {
-                               // The path may be in cygwin/msys notation so resolve it right away
-                               gitExe = resolve(null, w);
-                               if (gitExe != null)
-                                       return resolveGrandparentFile(gitExe);
-                       }
+                       if (w == null || w.length() == 0)
+                               return null;
+                       // The path may be in cygwin/msys notation so resolve it right away
+                       gitExe = resolve(null, w);
+                       if (gitExe != null)
+                               return resolveGrandparentFile(gitExe);
                }
 
                return null;