Browse Source

Pull up method for creating DirCacheEntry into RepositoryTestCase

Change-Id: I6e6522289553137df1a46ceeb52f461e9d25a290
stable-2.2
Robin Stocker 12 years ago
parent
commit
54aceb1769
  1. 18
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java
  2. 43
      org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java
  3. 87
      org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java
  4. 18
      org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/ForPathTest.java
  5. 60
      org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java
  6. 8
      org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java

18
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java

@ -473,4 +473,22 @@ public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
protected DirCacheEntry createEntry(final String path, final FileMode mode) {
return createEntry(path, mode, DirCacheEntry.STAGE_0, path);
}
protected DirCacheEntry createEntry(final String path, final FileMode mode,
final String content) {
return createEntry(path, mode, DirCacheEntry.STAGE_0, content);
}
protected DirCacheEntry createEntry(final String path, final FileMode mode,
final int stage, final String content) {
final DirCacheEntry entry = new DirCacheEntry(path, stage);
entry.setFileMode(mode);
entry.setObjectId(new ObjectInserter.Formatter().idFor(
Constants.OBJ_BLOB, Constants.encode(content)));
return entry;
}
} }

43
org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java

@ -44,16 +44,13 @@
package org.eclipse.jgit.merge; package org.eclipse.jgit.merge;
import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheBuilder; import org.eclipse.jgit.dircache.DirCacheBuilder;
import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.lib.CommitBuilder; import org.eclipse.jgit.lib.CommitBuilder;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectInserter; import org.eclipse.jgit.lib.ObjectInserter;
@ -81,16 +78,16 @@ public class CherryPickTest extends RepositoryTestCase {
final DirCacheBuilder p = treeP.builder(); final DirCacheBuilder p = treeP.builder();
final DirCacheBuilder t = treeT.builder(); final DirCacheBuilder t = treeT.builder();
b.add(makeEntry("a", FileMode.REGULAR_FILE)); b.add(createEntry("a", FileMode.REGULAR_FILE));
o.add(makeEntry("a", FileMode.REGULAR_FILE)); o.add(createEntry("a", FileMode.REGULAR_FILE));
o.add(makeEntry("o", FileMode.REGULAR_FILE)); o.add(createEntry("o", FileMode.REGULAR_FILE));
p.add(makeEntry("a", FileMode.REGULAR_FILE, "q")); p.add(createEntry("a", FileMode.REGULAR_FILE, "q"));
p.add(makeEntry("p-fail", FileMode.REGULAR_FILE)); p.add(createEntry("p-fail", FileMode.REGULAR_FILE));
t.add(makeEntry("a", FileMode.REGULAR_FILE)); t.add(createEntry("a", FileMode.REGULAR_FILE));
t.add(makeEntry("t", FileMode.REGULAR_FILE)); t.add(createEntry("t", FileMode.REGULAR_FILE));
b.finish(); b.finish();
o.finish(); o.finish();
@ -147,14 +144,14 @@ public class CherryPickTest extends RepositoryTestCase {
final DirCacheBuilder p = treeP.builder(); final DirCacheBuilder p = treeP.builder();
final DirCacheBuilder t = treeT.builder(); final DirCacheBuilder t = treeT.builder();
b.add(makeEntry("a", FileMode.REGULAR_FILE)); b.add(createEntry("a", FileMode.REGULAR_FILE));
p.add(makeEntry("a", FileMode.REGULAR_FILE, "q")); p.add(createEntry("a", FileMode.REGULAR_FILE, "q"));
p.add(makeEntry("p-fail", FileMode.REGULAR_FILE)); p.add(createEntry("p-fail", FileMode.REGULAR_FILE));
t.add(makeEntry("a", FileMode.REGULAR_FILE, "q")); t.add(createEntry("a", FileMode.REGULAR_FILE, "q"));
t.add(makeEntry("p-fail", FileMode.REGULAR_FILE)); t.add(createEntry("p-fail", FileMode.REGULAR_FILE));
t.add(makeEntry("t", FileMode.REGULAR_FILE)); t.add(createEntry("t", FileMode.REGULAR_FILE));
b.finish(); b.finish();
p.finish(); p.finish();
@ -203,18 +200,4 @@ public class CherryPickTest extends RepositoryTestCase {
odi.flush(); odi.flush();
return id; return id;
} }
private DirCacheEntry makeEntry(final String path, final FileMode mode)
throws Exception {
return makeEntry(path, mode, path);
}
private DirCacheEntry makeEntry(final String path, final FileMode mode,
final String content) throws Exception {
final DirCacheEntry ent = new DirCacheEntry(path);
ent.setFileMode(mode);
ent.setObjectId(new ObjectInserter.Formatter().idFor(OBJ_BLOB,
Constants.encode(content)));
return ent;
}
} }

87
org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java

@ -44,7 +44,6 @@
package org.eclipse.jgit.merge; package org.eclipse.jgit.merge;
import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@ -53,9 +52,7 @@ import java.io.IOException;
import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheBuilder; import org.eclipse.jgit.dircache.DirCacheBuilder;
import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.lib.CommitBuilder; import org.eclipse.jgit.lib.CommitBuilder;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectInserter; import org.eclipse.jgit.lib.ObjectInserter;
@ -123,15 +120,15 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
final DirCacheBuilder o = treeO.builder(); final DirCacheBuilder o = treeO.builder();
final DirCacheBuilder t = treeT.builder(); final DirCacheBuilder t = treeT.builder();
b.add(makeEntry("libelf-po/a", FileMode.REGULAR_FILE)); b.add(createEntry("libelf-po/a", FileMode.REGULAR_FILE));
b.add(makeEntry("libelf/c", FileMode.REGULAR_FILE)); b.add(createEntry("libelf/c", FileMode.REGULAR_FILE));
o.add(makeEntry("Makefile", FileMode.REGULAR_FILE)); o.add(createEntry("Makefile", FileMode.REGULAR_FILE));
o.add(makeEntry("libelf-po/a", FileMode.REGULAR_FILE)); o.add(createEntry("libelf-po/a", FileMode.REGULAR_FILE));
o.add(makeEntry("libelf/c", FileMode.REGULAR_FILE)); o.add(createEntry("libelf/c", FileMode.REGULAR_FILE));
t.add(makeEntry("libelf-po/a", FileMode.REGULAR_FILE)); t.add(createEntry("libelf-po/a", FileMode.REGULAR_FILE));
t.add(makeEntry("libelf/c", FileMode.REGULAR_FILE, "blah")); t.add(createEntry("libelf/c", FileMode.REGULAR_FILE, "blah"));
b.finish(); b.finish();
o.finish(); o.finish();
@ -176,14 +173,14 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
final DirCacheBuilder o = treeO.builder(); final DirCacheBuilder o = treeO.builder();
final DirCacheBuilder t = treeT.builder(); final DirCacheBuilder t = treeT.builder();
b.add(makeEntry("d/o", FileMode.REGULAR_FILE)); b.add(createEntry("d/o", FileMode.REGULAR_FILE));
b.add(makeEntry("d/t", FileMode.REGULAR_FILE)); b.add(createEntry("d/t", FileMode.REGULAR_FILE));
o.add(makeEntry("d/o", FileMode.REGULAR_FILE, "o !")); o.add(createEntry("d/o", FileMode.REGULAR_FILE, "o !"));
o.add(makeEntry("d/t", FileMode.REGULAR_FILE)); o.add(createEntry("d/t", FileMode.REGULAR_FILE));
t.add(makeEntry("d/o", FileMode.REGULAR_FILE)); t.add(createEntry("d/o", FileMode.REGULAR_FILE));
t.add(makeEntry("d/t", FileMode.REGULAR_FILE, "t !")); t.add(createEntry("d/t", FileMode.REGULAR_FILE, "t !"));
b.finish(); b.finish();
o.finish(); o.finish();
@ -224,14 +221,14 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
final DirCacheBuilder o = treeO.builder(); final DirCacheBuilder o = treeO.builder();
final DirCacheBuilder t = treeT.builder(); final DirCacheBuilder t = treeT.builder();
b.add(makeEntry("d/o", FileMode.REGULAR_FILE)); b.add(createEntry("d/o", FileMode.REGULAR_FILE));
b.add(makeEntry("d/t", FileMode.REGULAR_FILE)); b.add(createEntry("d/t", FileMode.REGULAR_FILE));
o.add(makeEntry("d/o", FileMode.REGULAR_FILE)); o.add(createEntry("d/o", FileMode.REGULAR_FILE));
o.add(makeEntry("d/t", FileMode.REGULAR_FILE, "o !")); o.add(createEntry("d/t", FileMode.REGULAR_FILE, "o !"));
t.add(makeEntry("d/o", FileMode.REGULAR_FILE, "t !")); t.add(createEntry("d/o", FileMode.REGULAR_FILE, "t !"));
t.add(makeEntry("d/t", FileMode.REGULAR_FILE, "t !")); t.add(createEntry("d/t", FileMode.REGULAR_FILE, "t !"));
b.finish(); b.finish();
o.finish(); o.finish();
@ -258,13 +255,13 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
final DirCacheBuilder o = treeO.builder(); final DirCacheBuilder o = treeO.builder();
final DirCacheBuilder t = treeT.builder(); final DirCacheBuilder t = treeT.builder();
b.add(makeEntry("d/o", FileMode.REGULAR_FILE)); b.add(createEntry("d/o", FileMode.REGULAR_FILE));
b.add(makeEntry("d/t", FileMode.REGULAR_FILE)); b.add(createEntry("d/t", FileMode.REGULAR_FILE));
o.add(makeEntry("d", FileMode.REGULAR_FILE)); o.add(createEntry("d", FileMode.REGULAR_FILE));
t.add(makeEntry("d/o", FileMode.REGULAR_FILE)); t.add(createEntry("d/o", FileMode.REGULAR_FILE));
t.add(makeEntry("d/t", FileMode.REGULAR_FILE, "t !")); t.add(createEntry("d/t", FileMode.REGULAR_FILE, "t !"));
b.finish(); b.finish();
o.finish(); o.finish();
@ -291,13 +288,13 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
final DirCacheBuilder o = treeO.builder(); final DirCacheBuilder o = treeO.builder();
final DirCacheBuilder t = treeT.builder(); final DirCacheBuilder t = treeT.builder();
b.add(makeEntry("d/o", FileMode.REGULAR_FILE)); b.add(createEntry("d/o", FileMode.REGULAR_FILE));
b.add(makeEntry("d/t", FileMode.REGULAR_FILE)); b.add(createEntry("d/t", FileMode.REGULAR_FILE));
o.add(makeEntry("d/o", FileMode.REGULAR_FILE)); o.add(createEntry("d/o", FileMode.REGULAR_FILE));
o.add(makeEntry("d/t", FileMode.REGULAR_FILE, "o !")); o.add(createEntry("d/t", FileMode.REGULAR_FILE, "o !"));
t.add(makeEntry("d", FileMode.REGULAR_FILE)); t.add(createEntry("d", FileMode.REGULAR_FILE));
b.finish(); b.finish();
o.finish(); o.finish();
@ -324,11 +321,11 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
final DirCacheBuilder o = treeO.builder(); final DirCacheBuilder o = treeO.builder();
final DirCacheBuilder t = treeT.builder(); final DirCacheBuilder t = treeT.builder();
b.add(makeEntry("d", FileMode.REGULAR_FILE)); b.add(createEntry("d", FileMode.REGULAR_FILE));
o.add(makeEntry("d", FileMode.REGULAR_FILE, "o !")); o.add(createEntry("d", FileMode.REGULAR_FILE, "o !"));
t.add(makeEntry("d/o", FileMode.REGULAR_FILE)); t.add(createEntry("d/o", FileMode.REGULAR_FILE));
b.finish(); b.finish();
o.finish(); o.finish();
@ -355,11 +352,11 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
final DirCacheBuilder o = treeO.builder(); final DirCacheBuilder o = treeO.builder();
final DirCacheBuilder t = treeT.builder(); final DirCacheBuilder t = treeT.builder();
b.add(makeEntry("d", FileMode.REGULAR_FILE)); b.add(createEntry("d", FileMode.REGULAR_FILE));
o.add(makeEntry("d/o", FileMode.REGULAR_FILE)); o.add(createEntry("d/o", FileMode.REGULAR_FILE));
t.add(makeEntry("d", FileMode.REGULAR_FILE, "t !")); t.add(createEntry("d", FileMode.REGULAR_FILE, "t !"));
b.finish(); b.finish();
o.finish(); o.finish();
@ -393,18 +390,4 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
odi.flush(); odi.flush();
return id; return id;
} }
private DirCacheEntry makeEntry(final String path, final FileMode mode)
throws Exception {
return makeEntry(path, mode, path);
}
private DirCacheEntry makeEntry(final String path, final FileMode mode,
final String content) throws Exception {
final DirCacheEntry ent = new DirCacheEntry(path);
ent.setFileMode(mode);
ent.setObjectId(new ObjectInserter.Formatter().idFor(OBJ_BLOB,
Constants.encode(content)));
return ent;
}
} }

18
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/ForPathTest.java

@ -49,7 +49,6 @@ import static org.junit.Assert.assertEquals;
import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheBuilder; import org.eclipse.jgit.dircache.DirCacheBuilder;
import org.eclipse.jgit.dircache.DirCacheEntry; import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectInserter; import org.eclipse.jgit.lib.ObjectInserter;
@ -65,15 +64,6 @@ public class ForPathTest extends RepositoryTestCase {
private static final FileMode EXECUTABLE_FILE = FileMode.EXECUTABLE_FILE; private static final FileMode EXECUTABLE_FILE = FileMode.EXECUTABLE_FILE;
private DirCacheEntry makeEntry(final String path, final FileMode mode)
throws Exception {
final DirCacheEntry ent = new DirCacheEntry(path);
ent.setFileMode(mode);
ent.setObjectId(new ObjectInserter.Formatter().idFor(
Constants.OBJ_BLOB, Constants.encode(path)));
return ent;
}
@Test @Test
public void testFindObjects() throws Exception { public void testFindObjects() throws Exception {
final DirCache tree0 = DirCache.newInCore(); final DirCache tree0 = DirCache.newInCore();
@ -81,13 +71,13 @@ public class ForPathTest extends RepositoryTestCase {
ObjectReader or = db.newObjectReader(); ObjectReader or = db.newObjectReader();
ObjectInserter oi = db.newObjectInserter(); ObjectInserter oi = db.newObjectInserter();
DirCacheEntry aDotB = makeEntry("a.b", EXECUTABLE_FILE); DirCacheEntry aDotB = createEntry("a.b", EXECUTABLE_FILE);
b0.add(aDotB); b0.add(aDotB);
DirCacheEntry aSlashB = makeEntry("a/b", REGULAR_FILE); DirCacheEntry aSlashB = createEntry("a/b", REGULAR_FILE);
b0.add(aSlashB); b0.add(aSlashB);
DirCacheEntry aSlashCSlashD = makeEntry("a/c/d", REGULAR_FILE); DirCacheEntry aSlashCSlashD = createEntry("a/c/d", REGULAR_FILE);
b0.add(aSlashCSlashD); b0.add(aSlashCSlashD);
DirCacheEntry aZeroB = makeEntry("a0b", SYMLINK); DirCacheEntry aZeroB = createEntry("a0b", SYMLINK);
b0.add(aZeroB); b0.add(aZeroB);
b0.finish(); b0.finish();
assertEquals(4, tree0.getEntryCount()); assertEquals(4, tree0.getEntryCount());

60
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java

@ -49,11 +49,8 @@ import static org.junit.Assert.assertTrue;
import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheBuilder; import org.eclipse.jgit.dircache.DirCacheBuilder;
import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.dircache.DirCacheIterator; import org.eclipse.jgit.dircache.DirCacheIterator;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.RepositoryTestCase; import org.eclipse.jgit.lib.RepositoryTestCase;
import org.junit.Test; import org.junit.Test;
@ -76,10 +73,10 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
final DirCacheBuilder b0 = tree0.builder(); final DirCacheBuilder b0 = tree0.builder();
final DirCacheBuilder b1 = tree1.builder(); final DirCacheBuilder b1 = tree1.builder();
b0.add(makeEntry("a", REGULAR_FILE)); b0.add(createEntry("a", REGULAR_FILE));
b0.add(makeEntry("a.b", EXECUTABLE_FILE)); b0.add(createEntry("a.b", EXECUTABLE_FILE));
b1.add(makeEntry("a/b", REGULAR_FILE)); b1.add(createEntry("a/b", REGULAR_FILE));
b0.add(makeEntry("a0b", SYMLINK)); b0.add(createEntry("a0b", SYMLINK));
b0.finish(); b0.finish();
b1.finish(); b1.finish();
@ -107,10 +104,10 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
final DirCacheBuilder b0 = tree0.builder(); final DirCacheBuilder b0 = tree0.builder();
final DirCacheBuilder b1 = tree1.builder(); final DirCacheBuilder b1 = tree1.builder();
b0.add(makeEntry("a", REGULAR_FILE)); b0.add(createEntry("a", REGULAR_FILE));
b0.add(makeEntry("a.b", EXECUTABLE_FILE)); b0.add(createEntry("a.b", EXECUTABLE_FILE));
b1.add(makeEntry("a/b", REGULAR_FILE)); b1.add(createEntry("a/b", REGULAR_FILE));
b0.add(makeEntry("a0b", SYMLINK)); b0.add(createEntry("a0b", SYMLINK));
b0.finish(); b0.finish();
b1.finish(); b1.finish();
@ -142,11 +139,11 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
final DirCacheBuilder b0 = tree0.builder(); final DirCacheBuilder b0 = tree0.builder();
final DirCacheBuilder b1 = tree1.builder(); final DirCacheBuilder b1 = tree1.builder();
b0.add(makeEntry("a", REGULAR_FILE)); b0.add(createEntry("a", REGULAR_FILE));
b0.add(makeEntry("a.b", EXECUTABLE_FILE)); b0.add(createEntry("a.b", EXECUTABLE_FILE));
b1.add(makeEntry("a.b", EXECUTABLE_FILE)); b1.add(createEntry("a.b", EXECUTABLE_FILE));
b1.add(makeEntry("a/b", REGULAR_FILE)); b1.add(createEntry("a/b", REGULAR_FILE));
b0.add(makeEntry("a0b", SYMLINK)); b0.add(createEntry("a0b", SYMLINK));
b0.finish(); b0.finish();
b1.finish(); b1.finish();
@ -178,11 +175,11 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
final DirCacheBuilder b0 = tree0.builder(); final DirCacheBuilder b0 = tree0.builder();
final DirCacheBuilder b1 = tree1.builder(); final DirCacheBuilder b1 = tree1.builder();
b0.add(makeEntry("a", REGULAR_FILE)); b0.add(createEntry("a", REGULAR_FILE));
b1.add(makeEntry("a.b", EXECUTABLE_FILE)); b1.add(createEntry("a.b", EXECUTABLE_FILE));
b1.add(makeEntry("a/b", REGULAR_FILE)); b1.add(createEntry("a/b", REGULAR_FILE));
b0.add(makeEntry("a0b", SYMLINK)); b0.add(createEntry("a0b", SYMLINK));
b1.add(makeEntry("a0b", SYMLINK)); b1.add(createEntry("a0b", SYMLINK));
b0.finish(); b0.finish();
b1.finish(); b1.finish();
@ -214,12 +211,12 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
final DirCacheBuilder b0 = tree0.builder(); final DirCacheBuilder b0 = tree0.builder();
final DirCacheBuilder b1 = tree1.builder(); final DirCacheBuilder b1 = tree1.builder();
b0.add(makeEntry("0", REGULAR_FILE)); b0.add(createEntry("0", REGULAR_FILE));
b0.add(makeEntry("a", REGULAR_FILE)); b0.add(createEntry("a", REGULAR_FILE));
b1.add(makeEntry("0", REGULAR_FILE)); b1.add(createEntry("0", REGULAR_FILE));
b1.add(makeEntry("a.b", REGULAR_FILE)); b1.add(createEntry("a.b", REGULAR_FILE));
b1.add(makeEntry("a/b", REGULAR_FILE)); b1.add(createEntry("a/b", REGULAR_FILE));
b1.add(makeEntry("a/c/e", REGULAR_FILE)); b1.add(createEntry("a/c/e", REGULAR_FILE));
b0.finish(); b0.finish();
b1.finish(); b1.finish();
@ -249,15 +246,6 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
assertFalse(tw.isDirectoryFileConflict()); assertFalse(tw.isDirectoryFileConflict());
} }
private DirCacheEntry makeEntry(final String path, final FileMode mode)
throws Exception {
final DirCacheEntry ent = new DirCacheEntry(path);
ent.setFileMode(mode);
ent.setObjectId(new ObjectInserter.Formatter().idFor(
Constants.OBJ_BLOB, Constants.encode(path)));
return ent;
}
private static void assertModes(final String path, final FileMode mode0, private static void assertModes(final String path, final FileMode mode0,
final FileMode mode1, final TreeWalk tw) throws Exception { final FileMode mode1, final TreeWalk tw) throws Exception {
assertTrue("has " + path, tw.next()); assertTrue("has " + path, tw.next());

8
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java

@ -53,9 +53,7 @@ import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheBuilder; import org.eclipse.jgit.dircache.DirCacheBuilder;
import org.eclipse.jgit.dircache.DirCacheEntry; import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.dircache.DirCacheIterator; import org.eclipse.jgit.dircache.DirCacheIterator;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.RepositoryTestCase; import org.eclipse.jgit.lib.RepositoryTestCase;
import org.junit.Test; import org.junit.Test;
@ -183,11 +181,7 @@ public class PostOrderTreeWalkTest extends RepositoryTestCase {
} }
private DirCacheEntry makeFile(final String path) throws Exception { private DirCacheEntry makeFile(final String path) throws Exception {
final DirCacheEntry ent = new DirCacheEntry(path); return createEntry(path, REGULAR_FILE);
ent.setFileMode(REGULAR_FILE);
ent.setObjectId(new ObjectInserter.Formatter().idFor(
Constants.OBJ_BLOB, Constants.encode(path)));
return ent;
} }
private static void assertModes(final String path, final FileMode mode0, private static void assertModes(final String path, final FileMode mode0,

Loading…
Cancel
Save