From c1e515ef91f26ba73490a21188f0fb93baa8889b Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Mon, 3 Feb 2014 17:28:05 +0400 Subject: [PATCH] [git] Don't read default commit message from .COMMIT_EDITMSG This actually reverts 07af6c9fa (apart from code style changes). It fixes IDEA-119753 and adding a newline after successful commit. The root cause is actually CommitChangeListDialog#setComment where the VCS CheckinEnvironment is asked even if we have some commit message in history, which is then overwritten by the message received from the VCS. It seems more logical to ask VCS _only_ if we have nothing to propose, but on the other hand, in such situations as merging it is very handy to use a pre-populated message from VCS, rather than the previous commit message as IDEA proposes. Implementing some sort of commit message provider priority seems to be an overhead for all of this => reverting commit which caused commit message to be read from the VCS more often looks like a better decision. --- .../src/git4idea/checkin/GitCheckinEnvironment.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java index cc8cce768f9a..d5c4b3fa8505 100644 --- a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java +++ b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java @@ -110,22 +110,16 @@ public class GitCheckinEnvironment implements CheckinEnvironment { for (VirtualFile root : GitUtil.gitRoots(Arrays.asList(filesToCheckin))) { VirtualFile mergeMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_MERGE_MSG); VirtualFile squashMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_SQUASH_MSG); - VirtualFile normalMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_COMMIT_EDITMSG); try { - if (mergeMsg == null && squashMsg == null && normalMsg == null) { + if (mergeMsg == null && squashMsg == null) { continue; } - String encoding = GitConfigUtil.getCommitEncoding(myProject, root); - if (mergeMsg != null) { messages.add(loadMessage(mergeMsg, encoding)); } - else if (squashMsg != null) { - messages.add(loadMessage(squashMsg, encoding)); - } else { - messages.add(loadMessage(normalMsg, encoding)); + messages.add(loadMessage(squashMsg, encoding)); } } catch (IOException e) {