use of org.eclipse.egit.core.op.ConfigureFetchAfterCloneTask in project egit by eclipse.
the class CloneOperationTest method testConfigureFetchAfterCloneTask.
@Test
public void testConfigureFetchAfterCloneTask() throws Exception {
createNoteInOrigin();
URIish uri = new URIish("file:///" + repository1.getRepository().getDirectory().toString());
CloneOperation clop = new CloneOperation(uri, true, null, workdir2, "refs/heads/master", "origin", 0);
clop.addPostCloneTask(new ConfigureFetchAfterCloneTask("origin", "refs/notes/review:refs/notes/review"));
clop.run(null);
Repository clonedRepo = FileRepositoryBuilder.create(new File(workdir2, Constants.DOT_GIT));
assertTrue(clonedRepo.getConfig().getStringList(ConfigConstants.CONFIG_REMOTE_SECTION, "origin", "fetch")[1].equals("refs/notes/review:refs/notes/review"));
Git clonedGit = new Git(clonedRepo);
assertEquals(1, clonedGit.notesList().setNotesRef("refs/notes/review").call().size());
clonedGit.close();
}
Aggregations