Skip to content

Clear preserved commit message when entering CommitEditorPanel #4558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ChrisMcD1
Copy link
Contributor

  • PR Description

Pretty basic implementation of this fix. The one thing I considered doing that I didn't was to rename OnCommitSuccess, since now 2 out of 4 call sites invoke it prior to make the commit message (and one does it here to invoke a tag, which might be a separate bug)

return self.gpg.WithGpgHandling(command, git_commands.TagGpgSign, self.c.Tr.CreatingTag, func() error {
self.commitsHelper.OnCommitSuccess()
return nil
}, []types.RefreshableView{types.COMMITS, types.TAGS})

The implementation of OnCommitSuccess also leaves me a bit confused. I'm not sure why it doesn't clear the message every time. By checking with the CommitMessageViewModel.preserveMessage, we only open up the option that we don't clear an existing message should that be false. Is there some world where this is desired? I figure if they are opening the window without the intent to save the message, it would be even more okay to throw away any potential message stored there.

func (self *CommitsHelper) OnCommitSuccess() {
// if we have a preserved message we want to clear it on success
if self.c.Contexts().CommitMessage.GetPreserveMessage() {
self.c.Contexts().CommitMessage.SetPreservedMessageAndLogError("")
}
}

Fixes #4557

  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preserved Commit Message not cleared when exiting git editor
1 participant