aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2010-07-13 12:28:42 +0000
committerMatthias Sohn <matthias.sohn@sap.com>2010-07-13 15:53:14 +0200
commit33160cd2da1a65ba8504b8c5b10828b03d80d9dd (patch)
tree235702bf795d9d04da1a8a3a720cfd6a9aa460be /org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
parentb878cdcf6b4c2445553dcd1507d5c3008bf56b7b (diff)
downloadjgit-33160cd2da1a65ba8504b8c5b10828b03d80d9dd.tar.gz
jgit-33160cd2da1a65ba8504b8c5b10828b03d80d9dd.zip
Fix ReadTreeTest
After refactoring ReadTreeTest the tests failed for filesystems with coarse modification time granularity. This is fixed by explicitly telling the repo to reread the index after we build a new index. Additionally the test testDirectoryFileSimple was simplified by using buildTree() instead of misusing GitIndex to construct trees. Change-Id: I20d2f097491e4cc8c657a696beabc7026b485017 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java22
1 files changed, 5 insertions, 17 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
index a1428eb641..5b4be4379e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
@@ -108,6 +108,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
}
index.write();
+ db.getIndex().read();
}
private Tree buildTree(HashMap<String, String> headEntries) throws IOException {
@@ -247,20 +248,9 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
}
public void testDirectoryFileSimple() throws IOException {
- GitIndex theIndex = new GitIndex(db);
- theIndex.add(trash, writeTrashFile("DF", "DF"));
- Tree treeDF = db.mapTree(theIndex.writeTree());
-
- recursiveDelete(new File(trash, "DF"));
- theIndex = new GitIndex(db);
- theIndex.add(trash, writeTrashFile("DF/DF", "DF/DF"));
- Tree treeDFDF = db.mapTree(theIndex.writeTree());
-
- theIndex = new GitIndex(db);
- recursiveDelete(new File(trash, "DF"));
-
- theIndex.add(trash, writeTrashFile("DF", "DF"));
- theIndex.write();
+ Tree treeDF = buildTree(mkmap("DF", "DF"));
+ Tree treeDFDF = buildTree(mkmap("DF/DF", "DF/DF"));
+ buildIndex(mkmap("DF", "DF"));
prescanTwoTrees(treeDF, treeDFDF);
@@ -268,9 +258,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertTrue(getUpdated().containsKey("DF/DF"));
recursiveDelete(new File(trash, "DF"));
- theIndex = new GitIndex(db);
- theIndex.add(trash, writeTrashFile("DF/DF", "DF/DF"));
- theIndex.write();
+ buildIndex(mkmap("DF/DF", "DF/DF"));
prescanTwoTrees(treeDFDF, treeDF);
assertTrue(getRemoved().contains("DF/DF"));