public void shouldNotCrashWhenCherryPickNoMergeIsCalledOnLastCommit() throws Exception
{
String[] branchNames = { "master" };
String[] files = { "test1.txt" };
List<String> commits = null;
CherryPickResult cherryPickResult = null;
Project project = projectFactory.createTempProject();
Git repo = gitUtils.init(project.getRootDirectory());
gitUtils.addAll(repo);
gitUtils.commitAll(repo, "initial commit");
FileResource<?> file0 = project.getRootDirectory().getChild(files[0]).reify(FileResource.class);
file0.createNewFile();
gitUtils.add(repo, files[0]);
gitUtils.commit(repo, "file added on " + branchNames[0]);
commits = gitUtils.getLogForCurrentBranch(repo);
Assert.assertEquals("Wrong number of commits in log", 2, commits.size());
cherryPickResult = gitUtils.cherryPickNoMerge(repo, repo.getRepository().getRef(branchNames[0]));
Assert.assertEquals("Wrong cherrypick status", CherryPickResult.CherryPickStatus.OK, cherryPickResult.getStatus());
gitUtils.resetHard(repo, "HEAD^1");
commits = gitUtils.getLogForCurrentBranch(repo);
Assert.assertEquals("Wrong number of commits in log", 1, commits.size());
try {