summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-12-07 18:13:36 -0800
committerShawn O. Pearce <spearce@spearce.org>2010-12-08 10:03:19 -0800
commit11fd0fe03ae471d1a6528070b4fee884b0ffea1d (patch)
tree7aaf70ec3c80c2ecb42d63071d749f9185f4a746 /org.eclipse.jgit.test/tst/org
parentc181e1ab8ac52ff8ce02f95affc8f79cfbfff323 (diff)
downloadjgit-11fd0fe03ae471d1a6528070b4fee884b0ffea1d.tar.gz
jgit-11fd0fe03ae471d1a6528070b4fee884b0ffea1d.zip
Clarify WorkingTreeOptions and filemode usage
To improve runtime performance, caching the WorkingTreeOptions inside of the Config object using the Config.SectionParser API allows the WorkingTreeOptions to be accessed more efficiently whenever a FileTreeIterator is constructed for the Repository. Instead of passing the filemode handling option into isModified(), the WorkingTreeIterator should always honor whatever setting has been configured in this repository, as defined by its own copy of the WorkingTreeOptions. This simplifies all of the callers as they no longer need to lookup core.filemode on their own. A few locations were changed from always using a hardcoded "true" on the file mode to passing what is actually configured in the repository. This is a behavior change, but corrects what should be considered to be bugs as the core.filemode variable wasn't always being used. Change-Id: Idb176736fa0dc97af372f1d652a94ecc72fb457c Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/AbstractTreeIteratorTest.java4
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java10
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorWithTimeControl.java4
3 files changed, 9 insertions, 9 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/AbstractTreeIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/AbstractTreeIteratorTest.java
index cc7d0ad9ef..86b5a0f62a 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/AbstractTreeIteratorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/AbstractTreeIteratorTest.java
@@ -49,10 +49,10 @@ import java.io.IOException;
import junit.framework.TestCase;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
+import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectReader;
-import org.eclipse.jgit.lib.CoreConfig.AutoCRLF;
public class AbstractTreeIteratorTest extends TestCase {
@@ -63,7 +63,7 @@ public class AbstractTreeIteratorTest extends TestCase {
public class FakeTreeIterator extends WorkingTreeIterator {
public FakeTreeIterator(String pathName, FileMode fileMode) {
- super(prefix(pathName), new WorkingTreeOptions(AutoCRLF.FALSE));
+ super(prefix(pathName), new Config().get(WorkingTreeOptions.KEY));
mode = fileMode.getBits();
final int s = pathName.lastIndexOf('/');
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
index ae519f4eab..22eeb8e3d3 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
@@ -80,7 +80,7 @@ public class FileTreeIteratorTest extends RepositoryTestCase {
final File r = new File(trash, paths[0]);
assertTrue(r.isFile());
final FileTreeIterator fti = new FileTreeIterator(r, db.getFS(),
- WorkingTreeOptions.createConfigurationInstance(db.getConfig()));
+ db.getConfig().get(WorkingTreeOptions.KEY));
assertTrue(fti.first());
assertTrue(fti.eof());
}
@@ -89,7 +89,7 @@ public class FileTreeIteratorTest extends RepositoryTestCase {
final File r = new File(trash, "not-existing-file");
assertFalse(r.exists());
final FileTreeIterator fti = new FileTreeIterator(r, db.getFS(),
- WorkingTreeOptions.createConfigurationInstance(db.getConfig()));
+ db.getConfig().get(WorkingTreeOptions.KEY));
assertTrue(fti.first());
assertTrue(fti.eof());
}
@@ -101,14 +101,14 @@ public class FileTreeIteratorTest extends RepositoryTestCase {
assertTrue(r.isDirectory());
final FileTreeIterator fti = new FileTreeIterator(r, db.getFS(),
- WorkingTreeOptions.createConfigurationInstance(db.getConfig()));
+ db.getConfig().get(WorkingTreeOptions.KEY));
assertTrue(fti.first());
assertTrue(fti.eof());
}
public void testSimpleIterate() throws Exception {
final FileTreeIterator top = new FileTreeIterator(trash, db.getFS(),
- WorkingTreeOptions.createConfigurationInstance(db.getConfig()));
+ db.getConfig().get(WorkingTreeOptions.KEY));
assertTrue(top.first());
assertFalse(top.eof());
@@ -157,7 +157,7 @@ public class FileTreeIteratorTest extends RepositoryTestCase {
public void testComputeFileObjectId() throws Exception {
final FileTreeIterator top = new FileTreeIterator(trash, db.getFS(),
- WorkingTreeOptions.createConfigurationInstance(db.getConfig()));
+ db.getConfig().get(WorkingTreeOptions.KEY));
final MessageDigest md = Constants.newMessageDigest();
md.update(Constants.encodeASCII(Constants.TYPE_BLOB));
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorWithTimeControl.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorWithTimeControl.java
index f15454ba07..8ea1fd9e98 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorWithTimeControl.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorWithTimeControl.java
@@ -46,9 +46,9 @@ import java.io.File;
import java.util.SortedSet;
import java.util.TreeSet;
+import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.lib.CoreConfig.AutoCRLF;
import org.eclipse.jgit.util.FS;
/**
@@ -88,7 +88,7 @@ public class FileTreeIteratorWithTimeControl extends FileTreeIterator {
public FileTreeIteratorWithTimeControl(File f, FS fs,
TreeSet<Long> modTimes) {
- super(f, fs, new WorkingTreeOptions(AutoCRLF.FALSE));
+ super(f, fs, new Config().get(WorkingTreeOptions.KEY));
this.modTimes = modTimes;
}