summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2015-11-20 14:33:15 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2015-11-21 01:49:49 +0100
commit18af2d42657dbe758b0d7ef88efb0cc466105da9 (patch)
treeb9981b422727c74244dd1408eae7ccd00dfce379 /org.eclipse.jgit.test
parent0353b1d3ff5554c6f84ee261c0c776efb58eec9b (diff)
downloadjgit-18af2d42657dbe758b0d7ef88efb0cc466105da9.tar.gz
jgit-18af2d42657dbe758b0d7ef88efb0cc466105da9.zip
Let FS_Win32_Cygwin detect symlink support by creating temporary symlink
The class FS_Win32 was always trying out to create a temporary symlink in order to find out whether symlinks are supported. FS_Win32_Cygwin was overwriting this method and always returned true. But when the user running JGit does not have administrative rights then the creation of symlinks is forbidden even if he is running on FS_Win32_Cygwin. A lot of tests failed only on the Windows platform because of this. It was correctly detected that FS_Win32_Cygwin is the filesystem abstraction to be used but creation of symlinks always failed because of lacking privileges of the user running the tests. This fix teaches FS_Win32_Cygwin to behave like FS_Win32 and to test whether symlinks can be created in order to find out whether symlinks are supported. Change-Id: Ie2394631ffc4c489bd37c3ec142ed44bbfcac726 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java6
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorJava7Test.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkJava7Test.java1
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FSJava7Test.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtils7Test.java1
5 files changed, 12 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
index 6d62528f85..51a6b5a8f5 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
@@ -79,6 +79,7 @@ import org.eclipse.jgit.treewalk.FileTreeIterator;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.FileUtils;
+import org.junit.Assume;
import org.junit.Test;
public class DirCacheCheckoutTest extends RepositoryTestCase {
@@ -925,6 +926,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
@Test
public void testCheckoutChangeLinkToEmptyDir() throws Exception {
+ Assume.assumeTrue(FS.DETECTED.supportsSymlinks());
String fname = "was_file";
Git git = Git.wrap(db);
@@ -961,6 +963,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
@Test
public void testCheckoutChangeLinkToEmptyDirs() throws Exception {
+ Assume.assumeTrue(FS.DETECTED.supportsSymlinks());
String fname = "was_file";
Git git = Git.wrap(db);
@@ -999,6 +1002,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
@Test
public void testCheckoutChangeLinkToNonEmptyDirs() throws Exception {
+ Assume.assumeTrue(FS.DETECTED.supportsSymlinks());
String fname = "file";
Git git = Git.wrap(db);
@@ -1043,6 +1047,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
@Test
public void testCheckoutChangeLinkToNonEmptyDirsAndNewIndexEntry()
throws Exception {
+ Assume.assumeTrue(FS.DETECTED.supportsSymlinks());
String fname = "file";
Git git = Git.wrap(db);
@@ -1364,6 +1369,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
@Test
public void testOverwriteUntrackedLinkModeChange()
throws Exception {
+ Assume.assumeTrue(FS.DETECTED.supportsSymlinks());
String fname = "file.txt";
Git git = Git.wrap(db);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorJava7Test.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorJava7Test.java
index 88754109f7..429f35ea4b 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorJava7Test.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorJava7Test.java
@@ -67,6 +67,7 @@ import org.junit.Test;
public class FileTreeIteratorJava7Test extends RepositoryTestCase {
@Test
public void testFileModeSymLinkIsNotATree() throws IOException {
+ org.junit.Assume.assumeTrue(FS.DETECTED.supportsSymlinks());
FS fs = db.getFS();
// mål = target in swedish, just to get som unicode in here
writeTrashFile("mål/data", "targetdata");
@@ -163,6 +164,7 @@ public class FileTreeIteratorJava7Test extends RepositoryTestCase {
*/
@Test
public void testSymlinkActuallyModified() throws Exception {
+ org.junit.Assume.assumeTrue(FS.DETECTED.supportsSymlinks());
final String NORMALIZED = "target";
final byte[] NORMALIZED_BYTES = Constants.encode(NORMALIZED);
try (ObjectInserter oi = db.newObjectInserter()) {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkJava7Test.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkJava7Test.java
index bb1f2a639b..1328b38e63 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkJava7Test.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkJava7Test.java
@@ -55,6 +55,7 @@ import org.junit.Test;
public class TreeWalkJava7Test extends RepositoryTestCase {
@Test
public void testSymlinkToDirNotRecursingViaSymlink() throws Exception {
+ org.junit.Assume.assumeTrue(FS.DETECTED.supportsSymlinks());
FS fs = db.getFS();
assertTrue(fs.supportsSymlinks());
writeTrashFile("target/data", "targetdata");
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FSJava7Test.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FSJava7Test.java
index e6a244e142..53b6fecfd8 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FSJava7Test.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FSJava7Test.java
@@ -57,6 +57,7 @@ import java.util.Set;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.junit.After;
+import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
@@ -87,6 +88,7 @@ public class FSJava7Test {
*/
@Test
public void testSymlinkAttributes() throws IOException, InterruptedException {
+ Assume.assumeTrue(FS.DETECTED.supportsSymlinks());
FS fs = FS.DETECTED;
File link = new File(trash, "ä");
File target = new File(trash, "å");
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtils7Test.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtils7Test.java
index 4625f30683..cc1fdc21b9 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtils7Test.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtils7Test.java
@@ -73,6 +73,7 @@ public class FileUtils7Test {
@Test
public void testDeleteSymlinkToDirectoryDoesNotDeleteTarget()
throws IOException {
+ org.junit.Assume.assumeTrue(FS.DETECTED.supportsSymlinks());
FS fs = FS.DETECTED;
File dir = new File(trash, "dir");
File file = new File(dir, "file");