git: Add handler to get default branch on remote (#36157)
Closes #36150 Release Notes: - Fixed `git: branch` action not worked with ssh workflow
This commit is contained in:
parent
5bbdd1a262
commit
0291db0d78
1 changed files with 18 additions and 0 deletions
|
@ -414,6 +414,7 @@ impl GitStore {
|
|||
pub fn init(client: &AnyProtoClient) {
|
||||
client.add_entity_request_handler(Self::handle_get_remotes);
|
||||
client.add_entity_request_handler(Self::handle_get_branches);
|
||||
client.add_entity_request_handler(Self::handle_get_default_branch);
|
||||
client.add_entity_request_handler(Self::handle_change_branch);
|
||||
client.add_entity_request_handler(Self::handle_create_branch);
|
||||
client.add_entity_request_handler(Self::handle_git_init);
|
||||
|
@ -1894,6 +1895,23 @@ impl GitStore {
|
|||
.collect::<Vec<_>>(),
|
||||
})
|
||||
}
|
||||
async fn handle_get_default_branch(
|
||||
this: Entity<Self>,
|
||||
envelope: TypedEnvelope<proto::GetDefaultBranch>,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<proto::GetDefaultBranchResponse> {
|
||||
let repository_id = RepositoryId::from_proto(envelope.payload.repository_id);
|
||||
let repository_handle = Self::repository_for_request(&this, repository_id, &mut cx)?;
|
||||
|
||||
let branch = repository_handle
|
||||
.update(&mut cx, |repository_handle, _| {
|
||||
repository_handle.default_branch()
|
||||
})?
|
||||
.await??
|
||||
.map(Into::into);
|
||||
|
||||
Ok(proto::GetDefaultBranchResponse { branch })
|
||||
}
|
||||
async fn handle_create_branch(
|
||||
this: Entity<Self>,
|
||||
envelope: TypedEnvelope<proto::GitCreateBranch>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue