Skip to content

Commit 3fde279

Browse files
committed
Merge branch 'wt/fix-polling-update-flow' into main
Fix polling/update flow bugs: path-based repo identity (RepoId), RAII cleanup guards, generation counters for diffs, fetch timeout, and fetch failure surfacing.
2 parents 081ba20 + 461eda7 commit 3fde279

File tree

13 files changed

+464
-248
lines changed

13 files changed

+464
-248
lines changed

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ notify = "8"
3131
notify-debouncer-full = "0.7"
3232
ureq = "3"
3333
serde_json = "1"
34+
wait-timeout = "0.2.1"
3435

3536
[dev-dependencies]
3637
tempfile = "3"

src/action.rs

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::git::graph::{DiffStat, GraphRow};
22
use crate::git::status::RepoStatus;
3+
use crate::repo_id::RepoId;
34

45
#[derive(Clone, Debug)]
56
#[allow(dead_code)]
@@ -10,13 +11,13 @@ pub(crate) enum Action {
1011
Resize(u16, u16),
1112
SelectNextRepo,
1213
SelectPrevRepo,
13-
SelectRepo(usize),
14+
SelectRepo(RepoId),
1415
RepoStatusUpdated {
15-
index: usize,
16+
id: RepoId,
1617
status: RepoStatus,
1718
},
1819
RefreshAll,
19-
RefreshRepo(usize),
20+
RefreshRepo(RepoId),
2021
/// Fast local status poll (no spinner, no fetch)
2122
PollLocal,
2223
/// Remote fetch poll (no spinner)
@@ -32,31 +33,35 @@ pub(crate) enum Action {
3233
stats: Vec<(git2::Oid, DiffStat)>,
3334
},
3435
ShowContextMenu {
35-
index: usize,
36+
id: RepoId,
3637
row: u16,
3738
col: u16,
3839
},
3940
HideContextMenu,
40-
CopyPath(usize),
41-
GitPush(usize),
42-
GitPull(usize),
43-
GitPullRebase(usize),
44-
GitPullSubmodules(usize),
45-
GitSubmoduleUpdate(usize),
46-
GitSubmoduleSync(usize),
47-
GitSubmoduleUpdateLatest(usize),
41+
CopyPath(RepoId),
42+
GitPush(RepoId),
43+
GitPull(RepoId),
44+
GitPullRebase(RepoId),
45+
GitPullSubmodules(RepoId),
46+
GitSubmoduleUpdate(RepoId),
47+
GitSubmoduleSync(RepoId),
48+
GitSubmoduleUpdateLatest(RepoId),
4849
GitOpComplete {
49-
index: usize,
50+
id: RepoId,
5051
message: String,
5152
},
52-
ShowDiff(usize, std::path::PathBuf),
53-
DiffLoaded(String),
53+
ShowDiff(RepoId, std::path::PathBuf),
54+
DiffLoaded {
55+
generation: u64,
56+
content: String,
57+
},
5458
GraphError(String),
5559
ShowCommitFiles {
5660
repo_path: std::path::PathBuf,
5761
oid: String,
5862
},
5963
CommitFilesLoaded {
64+
generation: u64,
6065
oid: String,
6166
message: String,
6267
files: Vec<(String, String)>,
@@ -66,14 +71,17 @@ pub(crate) enum Action {
6671
oid: String,
6772
file_path: String,
6873
},
69-
CommitDiffLoaded(String),
74+
CommitDiffLoaded {
75+
generation: u64,
76+
content: String,
77+
},
7078
OpenAddRepo,
7179
AddRepo(std::path::PathBuf),
72-
RemoveRepo(usize),
80+
RemoveRepo(RepoId),
7381
CycleSortOrder,
7482
RescanRepos,
7583
Error(String),
7684
UpdateAvailable(String),
7785
/// Clears the pending_status flag for a repo (sent on error paths)
78-
StatusQueryDone(usize),
86+
StatusQueryDone(RepoId),
7987
}

0 commit comments

Comments
 (0)