fix(workspace-state): stop resync loop on non-git folders and allow retry for degraded watcher

Gate git refresh on .git presence so file churn in non-git workspaces no longer produces endless resync_hint events, and silently log tree/git refresh errors during watch flushing instead of flagging requires_resync, which turned transient failures into self-reinforcing loops.

Degrade gracefully when the filesystem watcher fails to attach (e.g. permission denied, inotify quota): keep the initial snapshot, surface a degraded flag, and expose a store-level restart that the banner uses to retry attachment after the root cause is fixed.

Propagate is_git_repo through the snapshot so the git log and changes tabs render a dedicated "Not a Git repository" empty state instead of raw git stderr with a useless retry button.

Stop polling get_git_branch from the title bar once it returns null and re-arm on visibility change.

Add translations for the new banner, empty-state, and retry keys across all ten locales.
This commit is contained in:
xintaofei
2026-04-18 17:18:11 +08:00
parent c5c2bdd331
commit 7ef8d84d44
19 changed files with 380 additions and 74 deletions

View File

@@ -769,6 +769,12 @@
"applyRightNonConflicting": "应用远程"
},
"Folder": {
"workspaceStatus": {
"degradedTitle": "实时更新不可用",
"degradedHint": "监听器启动失败(如目录无读取权限)。请手动刷新以获取最新变更。",
"retry": "重试",
"retrying": "重试中..."
},
"common": {
"all": "全部",
"cancel": "取消",
@@ -1205,6 +1211,8 @@
"workspace": "工作区",
"retry": "重试",
"noCommitsFound": "未找到提交记录",
"notAGitRepoTitle": "不是 Git 仓库",
"notAGitRepoHint": "可从上方分支菜单初始化 Git或打开已有的 Git 仓库。",
"hash": "Hash",
"copyHash": "复制哈希",
"copyMessage": "复制提交消息",
@@ -1281,6 +1289,8 @@
"gitChangesTab": {
"workspace": "工作区",
"noChanges": "暂无本地改动",
"notAGitRepoTitle": "不是 Git 仓库",
"notAGitRepoHint": "可从上方分支菜单初始化 Git或打开已有的 Git 仓库。",
"trackedChanges": "本地已跟踪改动 ({count})",
"untrackedFiles": "本地未跟踪文件 ({count})",
"expandTracked": "展开已跟踪改动",