git_ui: Preserve in-progress commit message across reconnect (#58180)

Losing the connection on a remote project, or restarting Zed, while
editing a git commit message cleared the in-progress text, because the
Git panel rebuilds the commit buffer from the repository and discards
unsent input.

This persists the draft, scoped to the active repository's work
directory, in the panel's serialized state and restores it when the
panel is rebuilt from that state: at construction when the active
repository already matches, and again in `reopen_commit_buffer` once the
commit buffer loads. The restore only applies to an empty target buffer
whose work directory matches the active repository, so it never replays
committed or cleared text and never leaks a draft across repositories.
The persisted draft is cleared after a successful commit.

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 is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #47864

Release Notes:

- Fixed in-progress git commit messages being cleared when a remote
project reconnects or Zed restarts

---------

Co-authored-by: Cole Miller <cole@zed.dev>
bfe0d7c8f6Matt Van Horn committed on 6/27/2026, 8:29:20 PM· committed by GitHubparent968379f
2 files changedLine totals unavailable