fix: commits list and sync lagging after a sync
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s

This commit is contained in:
2026-11-26 09:40:28 +07:00
parent f57427d30d
commit ae41fac60a
5 changed files with 135 additions and 62 deletions
+1
View File
@@ -29,6 +29,7 @@ serde_json.workspace = true
rustls = "0.23"
[dev-dependencies]
gpui = { workspace = true, features = ["test-support"] }
tempfile = "3"
[lints]
+29 -2
View File
@@ -1275,6 +1275,9 @@ impl RepoStore {
let result = push.await;
this.update(cx, |this, cx| {
this.pushing = false;
this.push_steps.clear();
match &result {
Ok(outcome) => {
this.last_error = None;
@@ -1287,12 +1290,12 @@ impl RepoStore {
});
}
// Re-probe so sync badges reflect the pushed state.
let sync_status = SyncStatusStore::global(cx);
let addr = pushed_checkout
.as_ref()
.map(|(addr, _)| addr.clone())
.or_else(|| this.addr.clone());
sync_status.read(cx).probe(addr);
}
Err(e) => {
@@ -1371,6 +1374,8 @@ impl RepoStore {
let result = clone.await;
this.update(cx, |this, cx| {
this.cloning = false;
match &result {
Ok(()) => {
let checkouts = CheckoutsStore::global(cx);
@@ -1387,7 +1392,6 @@ impl RepoStore {
})?;
guard.abort();
result
})
}
@@ -1604,3 +1608,26 @@ fn comment_builder(
.into_event_builder()
.tags([Tag::coordinate(addr.clone().into(), None)])
}
#[cfg(test)]
mod tests {
use std::path::PathBuf;
use anyhow::anyhow;
use gpui::{AppContext as _, Task, TestAppContext};
use super::RepoStore;
#[gpui::test]
fn a_finished_push_releases_the_busy_flag(cx: &mut TestAppContext) {
let store = cx.new(|_| RepoStore::new_local(PathBuf::from("repo"), None));
let push = store.update(cx, |store, cx| {
store.run_push(Task::ready(Err(anyhow!("push refused"))), None, cx)
});
cx.run_until_parked();
assert!(push.is_ready());
assert!(!cx.update(|app| store.read(app).pushing));
}
}