aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
diff options
context:
space:
mode:
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.java37
1 files changed, 37 insertions, 0 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 2bf81e16f1..7473db932d 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
@@ -45,6 +45,12 @@
*/
package org.eclipse.jgit.lib;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -58,6 +64,7 @@ import org.eclipse.jgit.errors.CheckoutConflictException;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.treewalk.FileTreeIterator;
import org.eclipse.jgit.treewalk.TreeWalk;
+import org.junit.Test;
public abstract class ReadTreeTest extends RepositoryTestCase {
protected Tree theHead;
@@ -66,6 +73,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
// Each of these rules are from the read-tree manpage
// go there to see what they mean.
// Rule 0 is left out for obvious reasons :)
+ @Test
public void testRules1thru3_NoIndexEntry() throws IOException {
Tree head = new Tree(db);
head = buildTree(mk("foo"));
@@ -154,6 +162,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
// for these rules, they all have clean yes/no options
// but it doesn't matter if the entry is clean or not
// so we can just ignore the state in the filesystem entirely
+ @Test
public void testRules4thru13_IndexEntryNotInHead() throws IOException {
// rules 4 and 5
HashMap<String, String> idxMap;
@@ -251,6 +260,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertTrue(getConflicts().isEmpty());
}
+ @Test
public void testDirectoryFileSimple() throws IOException {
Tree treeDF = buildTree(mkmap("DF", "DF"));
Tree treeDFDF = buildTree(mkmap("DF/DF", "DF/DF"));
@@ -300,6 +310,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
*19 D 0 F Update
*/
+ @Test
public void testDirectoryFileConflicts_1() throws Exception {
// 1
doit(mk("DF/DF"), mk("DF"), mk("DF/DF"));
@@ -308,6 +319,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertRemoved("DF/DF");
}
+ @Test
public void testDirectoryFileConflicts_2() throws Exception {
// 2
setupCase(mk("DF/DF"), mk("DF"), mk("DF/DF"));
@@ -317,6 +329,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
}
+ @Test
public void testDirectoryFileConflicts_3() throws Exception {
// 3 - the first to break!
doit(mk("DF/DF"), mk("DF/DF"), mk("DF"));
@@ -324,6 +337,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertRemoved("DF");
}
+ @Test
public void testDirectoryFileConflicts_4() throws Exception {
// 4 (basically same as 3, just with H and M different)
doit(mk("DF/DF"), mkmap("DF/DF", "foo"), mk("DF"));
@@ -332,6 +346,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
}
+ @Test
public void testDirectoryFileConflicts_5() throws Exception {
// 5
doit(mk("DF/DF"), mk("DF"), mk("DF"));
@@ -339,6 +354,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
}
+ @Test
public void testDirectoryFileConflicts_6() throws Exception {
// 6
setupCase(mk("DF/DF"), mk("DF"), mk("DF"));
@@ -347,6 +363,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertRemoved("DF/DF");
}
+ @Test
public void testDirectoryFileConflicts_7() throws Exception {
// 7
doit(mk("DF"), mk("DF"), mk("DF/DF"));
@@ -375,6 +392,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
// This test would fail in DirCacheCheckoutTests.
}
+ @Test
public void testDirectoryFileConflicts_8() throws Exception {
// 8
setupCase(mk("DF"), mk("DF"), mk("DF/DF"));
@@ -384,6 +402,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertConflict("DF/DF");
}
+ @Test
public void testDirectoryFileConflicts_9() throws Exception {
// 9
doit(mk("DF"), mkmap("DF", "QP"), mk("DF/DF"));
@@ -391,6 +410,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertUpdated("DF");
}
+ @Test
public void testDirectoryFileConflicts_10() throws Exception {
// 10
cleanUpDF();
@@ -398,12 +418,14 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertNoConflicts();
}
+ @Test
public void testDirectoryFileConflicts_11() throws Exception {
// 11
doit(mk("DF"), mk("DF/DF"), mkmap("DF/DF", "asdf"));
assertConflict("DF/DF");
}
+ @Test
public void testDirectoryFileConflicts_12() throws Exception {
// 12
cleanUpDF();
@@ -412,6 +434,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertUpdated("DF/DF");
}
+ @Test
public void testDirectoryFileConflicts_13() throws Exception {
// 13
cleanUpDF();
@@ -422,6 +445,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertUpdated("DF/DF");
}
+ @Test
public void testDirectoryFileConflicts_14() throws Exception {
// 14
cleanUpDF();
@@ -430,6 +454,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertUpdated("DF/DF");
}
+ @Test
public void testDirectoryFileConflicts_15() throws Exception {
// 15
doit(mkmap(), mk("DF/DF"), mk("DF"));
@@ -441,6 +466,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertUpdated("DF/DF");
}
+ @Test
public void testDirectoryFileConflicts_15b() throws Exception {
// 15, take 2, just to check multi-leveled
doit(mkmap(), mk("DF/DF/DF/DF"), mk("DF"));
@@ -453,6 +479,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertUpdated("DF/DF/DF/DF");
}
+ @Test
public void testDirectoryFileConflicts_16() throws Exception {
// 16
cleanUpDF();
@@ -461,6 +488,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertUpdated("DF");
}
+ @Test
public void testDirectoryFileConflicts_17() throws Exception {
// 17
cleanUpDF();
@@ -476,6 +504,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
// assertUpdated("DF");
}
+ @Test
public void testDirectoryFileConflicts_18() throws Exception {
// 18
cleanUpDF();
@@ -484,6 +513,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertUpdated("DF/DF/DF/DF");
}
+ @Test
public void testDirectoryFileConflicts_19() throws Exception {
// 19
cleanUpDF();
@@ -536,6 +566,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
return map;
}
+ @Test
public void testUntrackedConflicts() throws IOException {
setupCase(null, mk("foo"), null);
writeTrashFile("foo", "foo");
@@ -574,6 +605,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertNoConflicts();
}
+ @Test
public void testCloseNameConflictsX0() throws IOException {
setupCase(mkmap("a/a", "a/a-c"), mkmap("a/a","a/a", "b.b/b.b","b.b/b.bs"), mkmap("a/a", "a/a-c") );
checkout();
@@ -585,6 +617,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertNoConflicts();
}
+ @Test
public void testCloseNameConflicts1() throws IOException {
setupCase(mkmap("a/a", "a/a-c"), mkmap("a/a","a/a", "a.a/a.a","a.a/a.a"), mkmap("a/a", "a/a-c") );
checkout();
@@ -596,6 +629,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertNoConflicts();
}
+ @Test
public void testCheckoutHierarchy() throws IOException {
setupCase(
mkmap("a", "a", "b/c", "b/c", "d", "d", "e/f", "e/f", "e/g",
@@ -613,6 +647,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
}
}
+ @Test
public void testCheckoutOutChanges() throws IOException {
setupCase(mk("foo"), mk("foo/bar"), mk("foo"));
checkout();
@@ -648,6 +683,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
}
}
+ @Test
public void testCheckoutUncachedChanges() throws IOException {
setupCase(mk("foo"), mk("foo"), mk("foo"));
writeTrashFile("foo", "otherData");
@@ -657,6 +693,7 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
assertTrue(new File(trash, "foo").isFile());
}
+ @Test
public void testDontOverwriteDirtyFile() throws IOException {
setupCase(mk("foo"), mk("other"), mk("foo"));
writeTrashFile("foo", "different");