Git activity indicator (#28204)

Closes #26182

Release Notes:

- Added an activity indicator for long-running git commands.

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
Julia Ryan 2025-04-07 11:10:01 -07:00 committed by GitHub
parent 4f9f443452
commit e3830d2ef5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 625 additions and 487 deletions

View file

@ -88,7 +88,7 @@ impl BranchList {
) -> Self {
let all_branches_request = repository
.clone()
.map(|repository| repository.read(cx).branches());
.map(|repository| repository.update(cx, |repository, _| repository.branches()));
cx.spawn_in(window, async move |this, cx| {
let mut all_branches = all_branches_request
@ -202,10 +202,15 @@ impl BranchListDelegate {
return;
};
cx.spawn(async move |_, cx| {
cx.update(|cx| repo.read(cx).create_branch(new_branch_name.to_string()))?
.await??;
cx.update(|cx| repo.read(cx).change_branch(new_branch_name.to_string()))?
.await??;
repo.update(cx, |repo, _| {
repo.create_branch(new_branch_name.to_string())
})?
.await??;
repo.update(cx, |repo, _| {
repo.change_branch(new_branch_name.to_string())
})?
.await??;
Ok(())
})
.detach_and_prompt_err("Failed to create branch", window, cx, |e, _, _| {
@ -359,11 +364,13 @@ impl PickerDelegate for BranchListDelegate {
.ok_or_else(|| anyhow!("No active repository"))?
.clone();
let cx = cx.to_async();
let mut cx = cx.to_async();
anyhow::Ok(async move {
cx.update(|cx| repo.read(cx).change_branch(branch.name.to_string()))?
.await?
repo.update(&mut cx, |repo, _| {
repo.change_branch(branch.name.to_string())
})?
.await?
})
})??;