]> source.dussan.org Git - jgit.git/commitdiff
JGit CLI should check if calling itself when invoking native git exe 12/59012/2
authorKaloyan Raev <kaloyan.r@zend.com>
Tue, 27 Oct 2015 14:14:54 +0000 (16:14 +0200)
committerChristian Halstrick <christian.halstrick@sap.com>
Thu, 29 Oct 2015 08:35:58 +0000 (04:35 -0400)
Bug: 480782
Change-Id: I0d7f7a648671e7ff678f2b19fe39b85f8835c061
Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java

index d860d8ac723803efebcae6fbf622e1c907a41e57..f5cdab0f4d428b87886d9b930c4accbe1b235a74 100644 (file)
@@ -556,6 +556,14 @@ public abstract class FS {
                        return null;
                }
 
+               // Bug 480782: Check if the discovered git executable is JGit CLI
+               String v = readPipe(gitExe.getParentFile(),
+                               new String[] { "git", "--version" }, //$NON-NLS-1$ //$NON-NLS-2$
+                               Charset.defaultCharset().name());
+               if (v.startsWith("jgit")) { //$NON-NLS-1$
+                       return null;
+               }
+
                // Trick Git into printing the path to the config file by using "echo"
                // as the editor.
                Map<String, String> env = new HashMap<>();