[git] IDEA-134721 Don't let fixup at the first position in rebase editor

This commit is contained in:
Kirill Likhodedov
2014-12-24 17:46:14 +03:00
parent b4e905df62
commit 9ef5173019
2 changed files with 5 additions and 3 deletions
@@ -256,7 +256,7 @@ rebase.editor.button=Start Rebasing
rebase.editor.comment.column=Comment
rebase.editor.commit.column=Commit
rebase.editor.invalid.entryset=No commits found to rebase
rebase.editor.invalid.squash=The first non-skip commit could not be marked as squashed since squash merges commit with the previous commit.
rebase.editor.invalid.squash=The first non-skip commit can't be marked as {0} since it merges commit with the previous commit.
rebase.editor.message=Reorder and edit &rebased commits
rebase.editor.move.down.tooltip=Move commit down (commit will be applied later)
rebase.editor.move.down=Move &Down
@@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ListWithSelection;
@@ -167,8 +168,9 @@ public class GitRebaseEditor extends DialogWrapper {
while (i < entries.size() && entries.get(i).getAction() == GitRebaseEntry.Action.skip) {
i++;
}
if (i < entries.size() && entries.get(i).getAction() == GitRebaseEntry.Action.squash) {
setErrorText(GitBundle.getString("rebase.editor.invalid.squash"));
GitRebaseEntry.Action action = entries.get(i).getAction();
if (i < entries.size() && (action == GitRebaseEntry.Action.squash || action == GitRebaseEntry.Action.fixup)) {
setErrorText(GitBundle.message("rebase.editor.invalid.squash", StringUtil.toLowerCase(action.name())));
setOKActionEnabled(false);
return;
}