diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 73ef8212bdc1004679b395861ca8827c2327e4b2..2beb18fd76e622dc0a58a6079849f361efd2c547 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -1049,7 +1049,7 @@ impl GitPanel { cx, ) })? - .await??; + .await?; let tasks: Vec<_> = cx.update(|cx| { buffers diff --git a/crates/project/src/git_store.rs b/crates/project/src/git_store.rs index 8c03f3bbaaa6545cddab7010e499c9e58d0468e9..ef5345a20e7eac19ec9f73fd8c9a1c5f4f4dc03b 100644 --- a/crates/project/src/git_store.rs +++ b/crates/project/src/git_store.rs @@ -2160,7 +2160,7 @@ impl GitStore { .update(&mut cx, |repository_handle, cx| { repository_handle.checkout_files(&envelope.payload.commit, paths, cx) })? - .await??; + .await?; Ok(proto::Ack {}) } @@ -3651,44 +3651,50 @@ impl Repository { &mut self, commit: &str, paths: Vec, - _cx: &mut App, - ) -> oneshot::Receiver> { + cx: &mut Context, + ) -> Task> { let commit = commit.to_string(); let id = self.id; - // let mut edits = Vec::with_capacity(paths.len()); - // let mut ids = Vec::with_capacity(paths.len()); - // for path in &paths { - - // } - // self.snapshot.pending_ops_by_path.edit(edits, ()); - - self.send_job( - Some(format!("git checkout {}", commit).into()), - move |git_repo, _| async move { - match git_repo { - RepositoryState::Local { - backend, - environment, - .. - } => { - backend - .checkout_files(commit, paths, environment.clone()) - .await - } - RepositoryState::Remote { project_id, client } => { - client - .request(proto::GitCheckoutFiles { - project_id: project_id.0, - repository_id: id.to_proto(), - commit, - paths: paths.into_iter().map(|p| p.to_proto()).collect(), - }) - .await?; + self.spawn_job_with_tracking( + paths.clone(), + pending_op::GitStatus::Reverted, + cx, + async move |this, cx| { + this.update(cx, |this, _cx| { + this.send_job( + Some(format!("git checkout {}", commit).into()), + move |git_repo, _| async move { + match git_repo { + RepositoryState::Local { + backend, + environment, + .. + } => { + backend + .checkout_files(commit, paths, environment.clone()) + .await + } + RepositoryState::Remote { project_id, client } => { + client + .request(proto::GitCheckoutFiles { + project_id: project_id.0, + repository_id: id.to_proto(), + commit, + paths: paths + .into_iter() + .map(|p| p.to_proto()) + .collect(), + }) + .await?; - Ok(()) - } - } + Ok(()) + } + } + }, + ) + })? + .await? }, ) } @@ -5225,9 +5231,9 @@ impl Repository { git_status: pending_op::GitStatus, cx: &mut Context, f: AsyncFn, - ) -> Task> + ) -> Task> where - AsyncFn: AsyncFnOnce(WeakEntity, &mut AsyncApp) -> anyhow::Result<()> + 'static, + AsyncFn: AsyncFnOnce(WeakEntity, &mut AsyncApp) -> Result<()> + 'static, { let ids = self.new_pending_ops_for_paths(paths, git_status);