@Test
public void cloneIntoSubDirectory() throws Exception {

	Repository existing = git.repo();
	RevCommit commit = git.add("file.txt", "abcd");
	BuildRepository repo = new BuildRepository(existing.getDirectory()
			.toURI().toString(), "master", "sub1");
	CloneOperation op = new CloneOperation(repo);
	File dir = git.tempDirectory();
	Repository cloned = op.invoke(dir, null);
	assertNotNull(cloned);
	assertFalse(existing.getDirectory().equals(cloned.getDirectory()));
	assertFalse(new File(dir, Constants.DOT_GIT).exists());
	assertTrue(new File(dir, repo.getDirectory()).exists());
	assertTrue(new File(dir, repo.getDirectory() + File.separatorChar
			+ Constants.DOT_GIT).exists());
	assertNotNull(CommitUtils.getCommit(cloned, commit));
}