deleteCommitMessageComponentState();
if (!indexDiffAvailable)
return; // only try to restore the stored repo commit message if
// indexDiff is ready
CommitHelper helper = new CommitHelper(currentRepository);
CommitMessageComponentState oldState = null;
if (repositoryChanged
|| commitMessageComponent.getRepository() != currentRepository) {
oldState = loadCommitMessageComponentState();
commitMessageComponent.setRepository(currentRepository);
if (oldState == null)
loadInitialState(helper);
else
loadExistingState(helper, oldState);
} else { // repository did not change
if (!commitMessageComponent.isAmending()
&& userEnteredCommitMessage()) {
if (!commitMessageComponent.getHeadCommit().equals(
helper.getPreviousCommit()))
addHeadChangedWarning(commitMessageComponent
.getCommitMessage());
} else
loadInitialState(helper);
}
amendPreviousCommitAction.setChecked(commitMessageComponent
.isAmending());
amendPreviousCommitAction.setEnabled(helper.amendAllowed());
updateMessage();
}