-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
base: master
Are you sure you want to change the base?
Clear preserved commit message when entering CommitEditorPanel #4558
Conversation
Looks good to me.
I'd be in favor of doing that. Maybe
I don't think that's a bug, but this call could be removed, because it does nothing (since we are opening the tags panel with preserveMessage=false, see below). Could be another, separate cleanup commit.
Yes. I think the idea is that creating tags doesn't take part in the remember-my-partial-commit-message business. I'm not sure how relevant this really is in practice, but something like:
|
It was actually called several times prior to a commit success in cases where the commit success would happen on a background process, and it only cleared the preserved commit message, so this makes sense.
The implementation of ClearPreservedCommitMessage was designed to protect against clearing in this scenario. We can remove that check if we just remove this callsite.
Ever since we removed the other functionality of this function, we have been slowly chipping away at its usages, in commits like 41a7afb. With the commit prior to this, now all usages are from call sites that actually want to clear the message because they have preserveMessage: true in their upstream, so we don't need to check if preserveMessage is true before clearing.
Stole your name because naming is hard 😆
Yeah, I misused the word "bug" there, I just meant "This is weird code". I have removed that call
I have done some research and I believe this is now never relevant in practice. So I added a commit removing the check. With previous commits like 41a7afb we have been whittling down the usages of OnCommitSuccess, and at this point there are 3 call sites:
which tracking their upstream leads to:
^ This is the method we are adding this clearing to in this PR, and I'm thinking it should clear the preserved message regardless of the previous state of (But now that I've put the whole paragraph into words, I'm actually less convinced than when it was an idea floating around in my head. I'm open to reverting this last commit if people want) |
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)lazygit/pkg/gui/controllers/helpers/tags_helper.go
Lines 36 to 39 in 5d30409
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 theCommitMessageViewModel.preserveMessage
, we only open up the option that we don't clear an existing message should that befalse
. 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.lazygit/pkg/gui/controllers/helpers/commits_helper.go
Lines 160 to 165 in 5d30409
Fixes #4557
go generate ./...
)