int (@NotNull File file) { try { if (myRebaseEditorShown) { String encoding = GitConfigUtil.getCommitEncoding(myProject, myRoot); String originalMessage = FileUtil.loadFile(file, encoding); String newMessage = myRewordedCommitMessageProvider.getRewordedCommitMessage(myProject, myRoot, originalMessage); if (newMessage == null) { myUnstructuredEditorCancelled = !handleUnstructuredEditor(file); return myUnstructuredEditorCancelled ? ERROR_EXIT_CODE : 0; } FileUtil.writeToFile(file, newMessage.getBytes(Charset.forName(encoding))); return 0; } else { setRebaseEditorShown(); boolean success = handleInteractiveEditor(file); if (success) { return 0; } else { myCommitListCancelled = true; return ERROR_EXIT_CODE; } } } catch (VcsException e) { LOG.error("Failed to load commit details for commits from git rebase file: " + file, e); return ERROR_EXIT_CODE; } catch (Exception e) { LOG.error("Failed to edit git rebase file: " + file, e); return ERROR_EXIT_CODE; } }