writeTrashFile(FILE1, FILE1 + "b");
git.add().addFilepattern(FILE1).call();
git.commit().setMessage("Change file1").call();
RebaseResult result = git.rebase().setUpstream("HEAD~3")
.runInteractively(new InteractiveHandler() {
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.PICK);
steps.remove(1);
steps.get(1).setAction(Action.SQUASH);
} catch (IllegalTodoFileModification e) {
fail("unexpected exception: " + e);
}
}
public String modifyCommitMessage(String commit) {
return "squashed message";
}
}).call();
assertEquals(Status.STOPPED, result.getStatus());
git.add().addFilepattern(FILE1).call();
result = git.rebase().runInteractively(new InteractiveHandler() {
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.PICK);
steps.remove(1);