private void checkoutTwoTrees() throws FileNotFoundException, IOException { for (String path : removed) { index.remove(root, new File(root, path)); } for (java.util.Map.Entry<String, ObjectId> entry : updated.entrySet()) { Entry newEntry = index.addEntry(merge.findBlobMember(entry.getKey())); index.checkoutEntry(root, newEntry); } }
public void testDelete() throws Exception { GitIndex index = new GitIndex(db); writeTrashFile("a/b", "data:a/b"); writeTrashFile("a:b", "data:a:b"); writeTrashFile("a.b", "data:a.b"); index.add(trash, new File(trash, "a/b")); index.add(trash, new File(trash, "a:b")); index.add(trash, new File(trash, "a.b")); index.write(); index.writeTree(); index.remove(trash, new File(trash, "a:b")); index.write(); assertEquals("a.b", index.getMembers()[0].getName()); assertEquals("a/b", index.getMembers()[1].getName()); GitIndex indexr = new GitIndex(db); indexr.read(); assertEquals("a.b", indexr.getMembers()[0].getName()); assertEquals("a/b", indexr.getMembers()[1].getName()); if (canrungitstatus) assertEquals(0, system(trash, "git status")); }