mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
git: trim leading newline in the squash message editor
Fixes IDEA-193688 When squashing two commits, Git proposes the following message: ``` # This is a combination of 2 commits. # This is the 1st commit message: first # This is the commit message #2: second ``` Since we remove commented lines, we show the following message: ``` first second ``` The first newline looks like a bug and never makes sense. We could be even more intelligent and remove the newline before the second commit message as well, but this would require parsing of commented messages, whose texts are not specified.
This commit is contained in:
@@ -39,6 +39,7 @@ import static com.intellij.CommonBundle.getCancelButtonText;
|
||||
import static com.intellij.CommonBundle.getOkButtonText;
|
||||
import static com.intellij.openapi.ui.Messages.getQuestionIcon;
|
||||
import static com.intellij.openapi.util.text.StringUtil.splitByLinesKeepSeparators;
|
||||
import static com.intellij.openapi.util.text.StringUtil.trimLeading;
|
||||
import static git4idea.DialogManager.showOkCancelDialog;
|
||||
import static git4idea.rebase.GitRebaseEditorMain.ERROR_EXIT_CODE;
|
||||
|
||||
@@ -98,7 +99,7 @@ public class GitInteractiveRebaseEditorHandler implements Closeable, GitRebaseEd
|
||||
protected boolean handleUnstructuredEditor(@NotNull String path) throws IOException {
|
||||
String encoding = GitConfigUtil.getCommitEncoding(myProject, myRoot);
|
||||
File file = new File(path);
|
||||
String initialText = ignoreComments(FileUtil.loadFile(file, encoding));
|
||||
String initialText = trimLeading(ignoreComments(FileUtil.loadFile(file, encoding)));
|
||||
|
||||
String newText = showUnstructuredEditor(initialText);
|
||||
if (newText == null) {
|
||||
|
||||
Reference in New Issue
Block a user