@Test
public void startHotfixWithNewCommit() throws Exception
{
Git git = RepoUtil.createRepositoryWithMasterAndDevelop(newDir());
JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();
//we should be on develop branch
flow.git().checkout().setName(flow.getDevelopBranchName()).call();
assertEquals(flow.getDevelopBranchName(), git.getRepository().getBranch());
//switch to master
git.checkout().setName("master").call();
//create a new commit
File junkFile = new File(git.getRepository().getWorkTree(), "junk.txt");
FileUtils.writeStringToFile(junkFile, "I am junk");
git.add().addFilepattern(junkFile.getName()).call();
RevCommit commit = git.commit().setMessage("committing junk file").call();
//make sure develop has our commit
assertTrue(GitHelper.isMergedInto(git, commit, flow.getMasterBranchName()));
flow.hotfixStart("1.0").call();
assertEquals(flow.getHotfixBranchPrefix() + "1.0", git.getRepository().getBranch());
//the hotfix branch should have our commit
assertTrue(GitHelper.isMergedInto(git, commit, flow.getHotfixBranchPrefix() + "1.0"));
}