# Ensure stale git commit template are not persisted \(\#63604\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/dbfeae7735ece8f929244744c219ace6c02f0dc5)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: dbfeae7735ece8f929244744c219ace6c02f0dc5

Requested commit: dbfeae7735ece8f929244744c219ace6c02f0dc5

Commit: dbfeae7735ece8f929244744c219ace6c02f0dc5

Tree: 697e5b5e8a25aba5064cbd6f9d5d60b2a75697da

Author: Sk Akram

Committer: GitHub

## Message

```
Ensure stale git commit template are not persisted (#63604)

## Objective

Fixes #63478

Git commit templates were being persisted as pending commit message
drafts. As a result, if the commit template changed, the previously
applied template could be restored after restarting Zed instead of
loading the updated template.

## Solution

Do not persist the active commit message buffer as a draft when its
contents exactly match the currently applied commit template.

This preserves the existing behavior for genuine user drafts while
allowing the current commit template to be loaded when the panel is
restored.

## Testing

Added tests covering:

* Applying a new commit template after the template changes and the
panel is restored.
* Preserving a user-edited commit message when the commit template
changes.

Validated with:

* `cargo test -p git_ui --
test_commit_template_applied_fresh_after_template_file_change
test_user_draft_preserved_when_template_changes --nocapture`
* `cargo fmt -p git_ui`
* `cargo check -p git_ui`
* `cargo test -p git_ui --lib`
* `cargo clippy -p git_ui --tests -- -D warnings`

## Self-Review Checklist

* [x] I've reviewed my own diff for quality, security, and reliability
* [x] Unsafe blocks (if any) have justifying comments
* [x] The content adheres to Zed's UI standards
* [x] Tests cover the new/changed behavior
* [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed stale git commit templates being restored as pending commit
message drafts.

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
```

## Parents

- [480d81bf6ae9d344b81b7cb82a535a197a9b4832](https://git.cafe/gitcafe/zed/commit/480d81bf6ae9d344b81b7cb82a535a197a9b4832?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/dbfeae7735ece8f929244744c219ace6c02f0dc5?format=markdown)
