git_ui: Always use latest commit message on amend#44553
Merged
smitbarmase merged 3 commits intomainfrom Dec 12, 2025
Merged
Conversation
- Update `FakeGitRepository.show` to include a message in the returned `CommitDetails` so we can assert that this specific commit message is set in the commit message editor. - Add default implementation for `FakeGitRepository.commit` and `FakeGitRepository.run_hook` to ensure that tests are able to run and don't panic on `unimplemented!()` - Refactor `GitPanel.load_last_commit_message_if_empty` to `GitPanel.load_last_commit_message`, ensuring that the head commit message is always loaded, regardless of whether the commit message editor is empty. A new test has also been introduced for these changes but, on actual testing I've noticed that the editor is still clearing after amending the commit. I believe this has to do witht the `GitPanel.commit_changes` implementation, seeing as there's a background task that is spawned which, after successful completion, clears the commit message editor.
- Update `GitPanel.commit_changes` to ensure that the pending amend state is only updated if the editor managed to actually commit the changes. This also ensures that we don't restore the commit message editor's contents when amending a commit, before the amend is actually processed. - Update `CommitModal.amend`, removing the call to `GitPanel.set_amend_pending` as that is now handled by the background task created in `GitPanel.commit_changes`.
Split the `commit` and `amend` methods from the event handlers so that the methods can be called directly, as is now being done by `CommitModal.on_commit` and `CommitModal.on_amend`.
nrbnlulu
pushed a commit
to nrbnlulu/zed
that referenced
this pull request
Dec 14, 2025
Update the behavior of `git::Amend` to ensure that the latest head commit message, if available, is always loaded into the commit message editor, regardless of its state. The previous text, if any, is now also restored after the amend is finished. - Update `FakeGitRepository.show` to include a message in the returned `CommitDetails` so we can assert that this specific commit message is set in the commit message editor. - Add default implementation for `FakeGitRepository.commit` and `FakeGitRepository.run_hook` to ensure that tests are able to run and don't panic on `unimplemented!()` - Refactor `GitPanel.load_last_commit_message_if_empty` to `GitPanel.load_last_commit_message`, ensuring that the head commit message is always loaded, regardless of whether the commit message editor is empty. - Update `GitPanel.commit_changes` to ensure that the pending amend state is only updated if the editor managed to actually commit the changes. This also ensures that we don't restore the commit message editor's contents when amending a commit, before the amend is actually processed. - Update `CommitModal.amend`, removing the call to `GitPanel.set_amend_pending` as that is now handled by the background task created in `GitPanel.commit_changes`. - Split the `commit` and `amend` methods from the event handlers so that the methods can be called directly, as is now being done by `CommitModal.on_commit` and `CommitModal.on_amend`. Release Notes: - Updated the `git: amend` command to always load the latest head commit message, and to restore any previously entered text in the commit message editor after the amend completes
CherryWorm
pushed a commit
to CherryWorm/zed
that referenced
this pull request
Dec 16, 2025
Update the behavior of `git::Amend` to ensure that the latest head commit message, if available, is always loaded into the commit message editor, regardless of its state. The previous text, if any, is now also restored after the amend is finished. - Update `FakeGitRepository.show` to include a message in the returned `CommitDetails` so we can assert that this specific commit message is set in the commit message editor. - Add default implementation for `FakeGitRepository.commit` and `FakeGitRepository.run_hook` to ensure that tests are able to run and don't panic on `unimplemented!()` - Refactor `GitPanel.load_last_commit_message_if_empty` to `GitPanel.load_last_commit_message`, ensuring that the head commit message is always loaded, regardless of whether the commit message editor is empty. - Update `GitPanel.commit_changes` to ensure that the pending amend state is only updated if the editor managed to actually commit the changes. This also ensures that we don't restore the commit message editor's contents when amending a commit, before the amend is actually processed. - Update `CommitModal.amend`, removing the call to `GitPanel.set_amend_pending` as that is now handled by the background task created in `GitPanel.commit_changes`. - Split the `commit` and `amend` methods from the event handlers so that the methods can be called directly, as is now being done by `CommitModal.on_commit` and `CommitModal.on_amend`. Release Notes: - Updated the `git: amend` command to always load the latest head commit message, and to restore any previously entered text in the commit message editor after the amend completes
someone13574
pushed a commit
to someone13574/zed
that referenced
this pull request
Dec 16, 2025
Update the behavior of `git::Amend` to ensure that the latest head commit message, if available, is always loaded into the commit message editor, regardless of its state. The previous text, if any, is now also restored after the amend is finished. - Update `FakeGitRepository.show` to include a message in the returned `CommitDetails` so we can assert that this specific commit message is set in the commit message editor. - Add default implementation for `FakeGitRepository.commit` and `FakeGitRepository.run_hook` to ensure that tests are able to run and don't panic on `unimplemented!()` - Refactor `GitPanel.load_last_commit_message_if_empty` to `GitPanel.load_last_commit_message`, ensuring that the head commit message is always loaded, regardless of whether the commit message editor is empty. - Update `GitPanel.commit_changes` to ensure that the pending amend state is only updated if the editor managed to actually commit the changes. This also ensures that we don't restore the commit message editor's contents when amending a commit, before the amend is actually processed. - Update `CommitModal.amend`, removing the call to `GitPanel.set_amend_pending` as that is now handled by the background task created in `GitPanel.commit_changes`. - Split the `commit` and `amend` methods from the event handlers so that the methods can be called directly, as is now being done by `CommitModal.on_commit` and `CommitModal.on_amend`. Release Notes: - Updated the `git: amend` command to always load the latest head commit message, and to restore any previously entered text in the commit message editor after the amend completes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update the behavior of
git::Amendto ensure that the latest head commit message, if available, is always loaded into the commit message editor, regardless of its state. The previous text, if any, is now also restored after the amend is finished.FakeGitRepository.showto include a message in the returnedCommitDetailsso we can assert that this specific commit message is set in the commit message editor.FakeGitRepository.commitandFakeGitRepository.run_hookto ensure that tests are able to run and don't panic onunimplemented!()GitPanel.load_last_commit_message_if_emptytoGitPanel.load_last_commit_message, ensuring that the head commit message is always loaded, regardless of whether the commit message editor is empty.GitPanel.commit_changesto ensure that the pending amend state is only updated if the editor managed to actually commit the changes. This also ensures that we don't restore the commit message editor's contents when amending a commit, before the amend is actually processed.CommitModal.amend, removing the call toGitPanel.set_amend_pendingas that is now handled by the background task created inGitPanel.commit_changes.commitandamendmethods from the event handlers so that the methods can be called directly, as is now being done byCommitModal.on_commitandCommitModal.on_amend.Release Notes:
git: amendcommand to always load the latest head commit message, and to restore any previously entered text in the commit message editor after the amend completes