public function testCanCommitFromIndex()
{
$master = $this->repo->getObject('master');
$this->index_adapter->write('anotherfile.txt', 'Another day, another file');
$tree = $this->repo->getIndex()->createTree();
$commit = new Entity\GitObject\Commit();
$commit->setTree($tree);
$commit->addParent($master);
$commit->setMessage("Added another file");
$commit->setAuthor(new Entity\GitObject\User("Tessie Testson", "*****@*****.**"));
$commit->setCommitter(new Entity\GitObject\User("Tessie Testson", "*****@*****.**"));
$commit->setAuthorTime(new \DateTime());
$commit->setCommitTime(new \DateTime());
$this->repo->desiccateGitObject($commit);
$this->repo->setBranch('master', $commit);
$this->repo->flush();
$new_master_adapter = new GitternCommitishReadOnlyAdapter($this->repo, "master");
$this->assertEquals(array('Tech specs.pdf', 'anotherfile.txt', 'classic.txt', 'newfile.txt'), $new_master_adapter->keys());
$this->assertEquals('Another day, another file', $new_master_adapter->read('anotherfile.txt'));
}