@Test(expected = DirtyWorkingTreeException.class)
public void startReleaseWithChangesAndUntrackedFile() throws Exception
{
Git git = RepoUtil.createRepositoryWithMasterAndDevelop(newDir());
JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();
git.checkout().setName("develop").call();
//we should be on develop branch
assertEquals(flow.getDevelopBranchName(), git.getRepository().getBranch());
//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.getDevelopBranchName()));
//change the file
FileUtils.writeStringToFile(junkFile, "I am junk again");
//create a new file
File junk2File = new File(git.getRepository().getWorkTree(), "junk2.txt");
FileUtils.writeStringToFile(junk2File, "I am junk 2");
try
{
flow.releaseStart("1.0").call();
}
catch (DirtyWorkingTreeException e)
{
assertEquals("Working tree has uncommitted changes and untracked files", e.getMessage());
throw e;