Browse Source

Merge "Fix MergeCommandTest to pass if File.executable is not supported" into stable-1.2

stable-1.2
Matthias Sohn 13 years ago committed by Code Review
parent
commit
78ebffd5f4
  1. 16
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java

16
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java

@ -60,6 +60,7 @@ import org.eclipse.jgit.lib.RepositoryTestCase;
import org.eclipse.jgit.merge.MergeStrategy; import org.eclipse.jgit.merge.MergeStrategy;
import org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason; import org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason;
import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.FileUtils; import org.eclipse.jgit.util.FileUtils;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.theories.DataPoints; import org.junit.experimental.theories.DataPoints;
@ -1025,6 +1026,9 @@ public class MergeCommandTest extends RepositoryTestCase {
@Test @Test
public void testFileModeMerge() throws Exception { public void testFileModeMerge() throws Exception {
if (!FS.DETECTED.supportsExecute())
return;
// Only Java6
Git git = new Git(db); Git git = new Git(db);
writeTrashFile("mergeableMode", "a"); writeTrashFile("mergeableMode", "a");
@ -1061,6 +1065,10 @@ public class MergeCommandTest extends RepositoryTestCase {
@Test @Test
public void testFileModeMergeWithDirtyWorkTree() throws Exception { public void testFileModeMergeWithDirtyWorkTree() throws Exception {
if (!FS.DETECTED.supportsExecute())
return;
// Only Java6 (or set x bit in index)
Git git = new Git(db); Git git = new Git(db);
writeTrashFile("mergeableButDirty", "a"); writeTrashFile("mergeableButDirty", "a");
@ -1089,13 +1097,13 @@ public class MergeCommandTest extends RepositoryTestCase {
} }
private void setExecutable(Git git, String path, boolean executable) { private void setExecutable(Git git, String path, boolean executable) {
new File(git.getRepository().getWorkTree(), path) FS.DETECTED.setExecute(
.setExecutable(executable); new File(git.getRepository().getWorkTree(), path), executable);
assertEquals(executable, canExecute(git, path));
} }
private boolean canExecute(Git git, String path) { private boolean canExecute(Git git, String path) {
return (new File(git.getRepository().getWorkTree(), path).canExecute()); return FS.DETECTED.canExecute(new File(git.getRepository()
.getWorkTree(), path));
} }
private RevCommit addAllAndCommit(final Git git) throws Exception { private RevCommit addAllAndCommit(final Git git) throws Exception {

Loading…
Cancel
Save