From 9ef51730195a8ab0a30d510b4aa54518afe6ecef Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Wed, 24 Dec 2014 17:44:28 +0300 Subject: [PATCH] [git] IDEA-134721 Don't let fixup at the first position in rebase editor --- plugins/git4idea/src/git4idea/i18n/GitBundle.properties | 2 +- plugins/git4idea/src/git4idea/rebase/GitRebaseEditor.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/git4idea/src/git4idea/i18n/GitBundle.properties b/plugins/git4idea/src/git4idea/i18n/GitBundle.properties index a2937584ec39..a48c05400bf3 100644 --- a/plugins/git4idea/src/git4idea/i18n/GitBundle.properties +++ b/plugins/git4idea/src/git4idea/i18n/GitBundle.properties @@ -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 diff --git a/plugins/git4idea/src/git4idea/rebase/GitRebaseEditor.java b/plugins/git4idea/src/git4idea/rebase/GitRebaseEditor.java index e3c9a1aa80c2..e0c9aa035257 100644 --- a/plugins/git4idea/src/git4idea/rebase/GitRebaseEditor.java +++ b/plugins/git4idea/src/git4idea/rebase/GitRebaseEditor.java @@ -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; }