Enable collaborating editing of the commit message input inside the git panel (#24130)

https://github.com/user-attachments/assets/200b88b8-249a-4841-97cd-fda8365efd00

Now all users in the collab/ssh session can edit the commit input
collaboratively, observing each others' changes live.

A real `.git/COMMIT_EDITMSG` file is opened, which automatically enables
its syntax highlight, but its original context is never used or saved on
disk — this way we avoid stale commit messages from previous commits
that git places there.

A caveat: previous version put some effort into preserving unfinished
commit messages on repo swtiches, but this version would not do that
— instead, it will be blank on startup, and use whatever
`.git/COMMIT_EDITMSG` contents on repo switch

Release Notes:

- N/A

---------

Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
Kirill Bulatov 2025-02-03 18:11:13 +02:00 committed by GitHub
parent 6b48a6e690
commit a864168c27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 595 additions and 364 deletions

View file

@ -311,7 +311,8 @@ message Envelope {
Stage stage = 293;
Unstage unstage = 294;
Commit commit = 295; // current max
Commit commit = 295;
OpenCommitMessageBuffer open_commit_message_buffer = 296; // current max
}
reserved 87 to 88;
@ -2655,7 +2656,12 @@ message Commit {
uint64 project_id = 1;
uint64 worktree_id = 2;
uint64 work_directory_id = 3;
string message = 4;
optional string name = 5;
optional string email = 6;
optional string name = 4;
optional string email = 5;
}
message OpenCommitMessageBuffer {
uint64 project_id = 1;
uint64 worktree_id = 2;
uint64 work_directory_id = 3;
}

View file

@ -249,6 +249,7 @@ messages!(
(OpenBufferForSymbol, Background),
(OpenBufferForSymbolResponse, Background),
(OpenBufferResponse, Background),
(OpenCommitMessageBuffer, Background),
(PerformRename, Background),
(PerformRenameResponse, Background),
(Ping, Foreground),
@ -443,6 +444,7 @@ request_messages!(
(OpenBufferById, OpenBufferResponse),
(OpenBufferByPath, OpenBufferResponse),
(OpenBufferForSymbol, OpenBufferForSymbolResponse),
(OpenCommitMessageBuffer, OpenBufferResponse),
(OpenNewBuffer, OpenBufferResponse),
(PerformRename, PerformRenameResponse),
(Ping, Ack),
@ -554,6 +556,7 @@ entity_messages!(
OpenBufferById,
OpenBufferByPath,
OpenBufferForSymbol,
OpenCommitMessageBuffer,
PerformRename,
PrepareRename,
RefreshInlayHints,