public void finishHotfixMultipleTimesWithCommits() throws Exception
{
String hfOneLabel = "1.0.1";
String hfTwoLabel = "1.0.2";
Git git = RepoUtil.createRepositoryWithMaster(newDir());
JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();
flow.hotfixStart(hfOneLabel).call();
assertEquals(flow.getHotfixBranchPrefix() + hfOneLabel, git.getRepository().getBranch());
File versionFile = new File(git.getRepository().getWorkTree(), "version.txt");
FileUtils.writeStringToFile(versionFile, hfOneLabel);
git.add().addFilepattern(".").call();
git.commit().setMessage("commiting version 1").call();
flow.hotfixFinish(hfOneLabel).call();
//we should be on develop branch
assertEquals(flow.getDevelopBranchName(), git.getRepository().getBranch());
FileUtils.writeStringToFile(versionFile, "develop");
git.add().addFilepattern(".").call();
git.commit().setMessage("commiting develop").call();
flow.hotfixStart(hfTwoLabel).call();
assertEquals(flow.getHotfixBranchPrefix() + hfTwoLabel, git.getRepository().getBranch());
FileUtils.writeStringToFile(versionFile, hfTwoLabel);
git.add().addFilepattern(".").call();
git.commit().setMessage("commiting version 2").call();
flow.hotfixFinish(hfTwoLabel).call();
//we should be on develop branch
assertEquals(flow.getDevelopBranchName(), git.getRepository().getBranch());
}