aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test/tst/org
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2013-01-05 00:34:03 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2014-02-10 22:53:33 +0100
commit078a9f60664fee1f7e85f0c3ab3fd067c0f674cc (patch)
tree1d7c3fbd97514dfcf96255f1debf0208674c1713 /org.eclipse.jgit.pgm.test/tst/org
parent5ef6d69532ebfc6c363c46f70a5f52d8369d2f9d (diff)
downloadjgit-078a9f60664fee1f7e85f0c3ab3fd067c0f674cc.tar.gz
jgit-078a9f60664fee1f7e85f0c3ab3fd067c0f674cc.zip
Add symlink support to JGit
The change includes comparing symbolic links between disk and index, adding symbolic links to the index, creating/modifying links on checkout. The behavior is controlled by the core.symlinks setting, just as C Git does. When a new repository is created core.symlinks will be set depending on the capabilities of the operating system and Java runtime. If core.symlinks is set to true, the assumption is that symlinks are supported, which may result in runtime errors if this turns out not to be the case. Measuring the cost of jgit status on a repository with ~70000 files, of which ~30000 are tracked reveals a penalty of about 10% for using the Java7 (really NIO2) support module. Bug: 354367 Change-Id: I12f0fdd9d26212324a586896ef7eb1f6ff89c39c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm.test/tst/org')
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java
index e869e85568..3c62e85502 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java
@@ -46,6 +46,8 @@ import static org.junit.Assert.assertArrayEquals;
import java.util.ArrayList;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.CLIRepositoryTestCase;
@@ -75,8 +77,28 @@ public class ConfigTest extends CLIRepositoryTestCase {
if (isMac)
expect.add("core.precomposeunicode=true");
expect.add("core.repositoryformatversion=0");
+ if (SystemReader.getInstance().isWindows() && osVersion() < 6
+ || javaVersion() < 1.7) {
+ expect.add("core.symlinks=false");
+ }
expect.add(""); // ends with LF (last line empty)
assertArrayEquals("expected default configuration", expect.toArray(),
output);
}
+
+ private static float javaVersion() {
+ String versionString = System.getProperty("java.version");
+ Matcher matcher = Pattern.compile("(\\d+\\.\\d+).*").matcher(
+ versionString);
+ matcher.matches();
+ return Float.parseFloat(matcher.group(1));
+ }
+
+ private static float osVersion() {
+ String versionString = System.getProperty("os.version");
+ Matcher matcher = Pattern.compile("(\\d+\\.\\d+).*").matcher(
+ versionString);
+ matcher.matches();
+ return Float.parseFloat(matcher.group(1));
+ }
}