Bladeren bron

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

tags/v1.2.0.201112221803-r
Matthias Sohn 12 jaren geleden
bovenliggende
commit
78ebffd5f4
1 gewijzigde bestanden met toevoegingen van 12 en 4 verwijderingen
  1. 12
    4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java

+ 12
- 4
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java Bestand weergeven

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;


@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");


@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");
} }


private void setExecutable(Git git, String path, boolean executable) { private void setExecutable(Git git, String path, boolean executable) {
new File(git.getRepository().getWorkTree(), path)
.setExecutable(executable);
assertEquals(executable, canExecute(git, path));
FS.DETECTED.setExecute(
new File(git.getRepository().getWorkTree(), path), executable);
} }


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 {

Laden…
Annuleren
Opslaan