Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't preserve commit message when it's unchanged from initial message (
#4110) - **PR Description** Sometimes we populate the commit message panel with a pre-created commit message. The two cases where this happens is: - you type `w` to commit, in which case we put the skipHookPrefix in the subject - you have a commitPrefix pattern, in which case we match it against the branch name and populate the subject with the replacement string if it matches In either case, if you have a preserved commit message, we use that. Now, when you use either of these and then cancel, we preserve that initial, unchanged message and reuse it the next time you commit. This has two problems: it strips spaces, which is a problem for the commitPrefix patterns, which often end with a space. And also, when you change your config to experiment with commitPrefix patterns, the change seemingly doesn't take effect, which can be very confusing. To fix both of these problems, only preserve the commit message when it is not identical to the initial message. - **Please check if the PR fulfills these requirements** * [x] Cheatsheets are up-to-date (run `go generate ./...`) * [x] Code has been formatted (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting)) * [x] Tests have been added/updated (see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md) for the integration test guide) * [ ] Text is internationalised (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation)) * [ ] If a new UserConfig entry was added, make sure it can be hot-reloaded (see [here](https://github.com/jesseduffield/lazygit/blob/master/docs/dev/Codebase_Guide.md#using-userconfig)) * [ ] Docs have been updated if necessary * [x] You've read through your own file changes for silly mistakes etc
- Loading branch information