Fix git branches in non-active repository (#26148)

Release Notes:

- Git Beta: Fixed a bug where the branch selector would only show for
the first repository opened.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Richard Feldman <oss@rtfeldman.com>
This commit is contained in:
Mikayla Maki 2025-03-05 13:16:46 -08:00 committed by GitHub
parent 2a919ad1d0
commit 9d54e63a11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 316 additions and 299 deletions

View file

@ -1,3 +1,4 @@
syntax = "proto3";
package zed.messages;
@ -278,7 +279,6 @@ message Envelope {
LanguageServerPromptRequest language_server_prompt_request = 268;
LanguageServerPromptResponse language_server_prompt_response = 269;
GitBranches git_branches = 270;
GitBranchesResponse git_branches_response = 271;
UpdateGitBranch update_git_branch = 272;
@ -332,7 +332,10 @@ message Envelope {
ApplyCodeActionKind apply_code_action_kind = 309;
ApplyCodeActionKindResponse apply_code_action_kind_response = 310;
RemoteMessageResponse remote_message_response = 311; // current max
RemoteMessageResponse remote_message_response = 311;
GitGetBranches git_get_branches = 312;
GitCreateBranch git_create_branch = 313;
GitChangeBranch git_change_branch = 314; // current max
}
reserved 87 to 88;
@ -348,6 +351,7 @@ message Envelope {
reserved 221;
reserved 224 to 229;
reserved 246;
reserved 270;
reserved 247 to 254;
reserved 255 to 256;
}
@ -2851,3 +2855,23 @@ message RemoteMessageResponse {
string stdout = 1;
string stderr = 2;
}
message GitGetBranches {
uint64 project_id = 1;
uint64 worktree_id = 2;
uint64 work_directory_id = 3;
}
message GitCreateBranch {
uint64 project_id = 1;
uint64 worktree_id = 2;
uint64 work_directory_id = 3;
string branch_name = 4;
}
message GitChangeBranch {
uint64 project_id = 1;
uint64 worktree_id = 2;
uint64 work_directory_id = 3;
string branch_name = 4;
}

View file

@ -424,7 +424,7 @@ messages!(
(FlushBufferedMessages, Foreground),
(LanguageServerPromptRequest, Foreground),
(LanguageServerPromptResponse, Foreground),
(GitBranches, Background),
(GitGetBranches, Background),
(GitBranchesResponse, Background),
(UpdateGitBranch, Background),
(ListToolchains, Foreground),
@ -452,6 +452,8 @@ messages!(
(GetRemotesResponse, Background),
(Pull, Background),
(RemoteMessageResponse, Background),
(GitCreateBranch, Background),
(GitChangeBranch, Background),
);
request_messages!(
@ -575,7 +577,7 @@ request_messages!(
(GetPermalinkToLine, GetPermalinkToLineResponse),
(FlushBufferedMessages, Ack),
(LanguageServerPromptRequest, LanguageServerPromptResponse),
(GitBranches, GitBranchesResponse),
(GitGetBranches, GitBranchesResponse),
(UpdateGitBranch, Ack),
(ListToolchains, ListToolchainsResponse),
(ActivateToolchain, Ack),
@ -594,6 +596,8 @@ request_messages!(
(Fetch, RemoteMessageResponse),
(GetRemotes, GetRemotesResponse),
(Pull, RemoteMessageResponse),
(GitCreateBranch, Ack),
(GitChangeBranch, Ack),
);
entity_messages!(
@ -679,7 +683,7 @@ entity_messages!(
OpenServerSettings,
GetPermalinkToLine,
LanguageServerPromptRequest,
GitBranches,
GitGetBranches,
UpdateGitBranch,
ListToolchains,
ActivateToolchain,
@ -695,6 +699,8 @@ entity_messages!(
Fetch,
GetRemotes,
Pull,
GitChangeBranch,
GitCreateBranch,
);
entity_messages!(