mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user