ElyTree: any new pick leaves a file history or blame (G-01)

The branch list's click goes through Tree::pick_ref, which clears the
look like every other pick; the test covers file, commit, side,
branch and remote picks. The test window installs the app's menus
first, as tool_root does: Windows and Linux draw the menu bar in the
window and panicked on an empty one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-10 15:21:13 -04:00
1 parent d9056c3564
commit 818491ad9f
5 files changed
+31 -10

No files matched your search

+12 -8
View File
@@ -71,14 +71,7 @@ pub fn branches(tree: &Entity<Tree>, cx: &mut Context<Changes>) -> AnyElement {
let this = tree.downgrade();
move |name: &gpui::SharedString, _: &mut gpui::Window, cx: &mut gpui::App| {
let name = name.to_string();
this.update(cx, |tree, cx| {
tree.look = None;
if let Some(opened) = tree.active.and_then(|id| tree.opened_mut(id)) {
opened.picked_ref = Some((kind, name));
}
cx.notify();
})
.ok();
this.update(cx, |tree, cx| tree.pick_ref(kind, name, cx)).ok();
}
};
let switch = |kind: Kind| {
@@ -175,3 +168,14 @@ pub fn branches(tree: &Entity<Tree>, cx: &mut Context<Changes>) -> AnyElement {
)
.into_any_element()
}
impl crate::tree::Tree {
/// A branch or tag picked: it shows, nothing else.
pub fn pick_ref(&mut self, kind: Kind, name: String, cx: &mut gpui::Context<Self>) {
self.look = None;
if let Some(opened) = self.active.and_then(|id| self.opened_mut(id)) {
opened.picked_ref = Some((kind, name));
}
cx.notify();
}
}
+14 -1
View File
@@ -35,6 +35,10 @@ pub(crate) fn window<'a>(
cx.update(|cx| {
ely_ui::settings::install_defaults(cx);
ely_ui::i18n::install(cx);
// As tool_root does: menus before the window.
let menus = crate::menu::menus(cx);
let menus = ely_ui::commands::menus(ely_platform::AppId::Tree, &ely_ui::commands::OPENING, false, menus, cx);
cx.set_menus(menus);
});
let recent = data.join("recent.json");
cx.add_window_view(move |window, cx| Tree::new(recent, window, cx))
@@ -333,7 +337,8 @@ fn any_new_pick_leaves_a_file_history() {
settle(cx, |app| branch(tree.read(app)).is_some());
let head = sh(&root, &["rev-parse", "HEAD"]).trim().to_string();
let looking = |cx: &mut VisualTestContext| cx.update(|_, app| tree.read(app).look.is_some());
let picks: [(&str, Box<dyn Fn(&mut Tree, &mut gpui::Context<Tree>)>); 3] = [
type Pick = Box<dyn Fn(&mut Tree, &mut gpui::Context<Tree>)>;
let picks: [(&str, Pick); 5] = [
(
"a tab",
Box::new(|tree, cx| tree.set_side(Side::Branches, cx)),
@@ -346,6 +351,14 @@ fn any_new_pick_leaves_a_file_history() {
"a file",
Box::new(|tree, cx| tree.show("a.txt", ChangeSection::Unstaged, cx)),
),
(
"a branch",
Box::new(|tree, cx| tree.pick_ref(crate::branches::Kind::Local, "main".into(), cx)),
),
(
"a remote",
Box::new(|tree, cx| tree.pick_place(crate::places::Place::Remote("origin".into()), cx)),
),
];
for (what, pick) in picks {
cx.update(|_, app| tree.update(app, |tree, cx| tree.file_log("a.txt", cx)));
+1 -1
View File
@@ -76,7 +76,7 @@
- [x] M-13 编辑器构建失败时页面空白且不上报 — 可视建不成退回源码并告知,两者都建不成即报失败、留下文字、模式请求重建、不留容器;新测 mark-broken.mjs(审查 2 轮)
- [x] M-14 `render_pdf` 在界面线程内嵌图片并写文件 — 打印页的内嵌、读样式与写入经 paper::stage 在后台执行,GPUI 单测证明执行器运行前未写(审查 2 轮)
- [x] M-15 打印与导出 PDF 的暂存页执行文档里的脚本 — 打印与导出 PDF 的暂存页以 WebView::open_inert 打开,脚本关;webprobe 以同页开脚本为对照(审查 2 轮)
- [ ] G-01 打开“文件历史”或“逐行追溯”后,中间区不再响应任何别的选择
- [x] G-01 打开“文件历史”或“逐行追溯”后,中间区不再响应任何别的选择 — 每个新选择(文件、提交、侧栏、分支、位置)都清掉文件历史与逐行追溯;测试窗口先装菜单(审查 2 轮)
- [ ] G-02 进行中操作读取失败被吞掉;`git am` 冲突无提示条无错误
- [ ] G-03 新建的空仓库在“仓库”页显示两段 Git 致命错误(引用日志、LFS)
- [ ] G-04 停止取回/拉取/推送失败的提示写成“克隆没有停下”
+3
View File
@@ -0,0 +1,3 @@
FAIL
- `apps/ely-tree/src/tests/window.rs:340` — G-01 的回归测试漏掉独立的分支选择回调和非提交类位置选择,只测了 `set_side`、`pick_commit`、`show`。在隔离副本中删除 `side_refs.rs:75` 与 `places.rs:97` 的 `look` 清理后,包含现有回归的 117 项适用测试仍全部通过(仅排除本轮原树也失败的 5 项 Linux 文件监视测试)。具体漏报场景:分支页显示文件历史后点击分支,或仓库页显示文件历史后选择远程 `origin`,选择已经改变,中间区却仍被旧历史覆盖。补做的真实分支点击及 `Place::Remote` 探针在当前实现上均通过,并验证历史与 Blame;同样探针在上述变异上均失败,证明现有测试保护不了这两条修复。修复方向:把这两个入口加入项目内的回归测试,打开历史或 Blame 后执行选择,断言旧面板退出,并验证删除对应清理语句会使测试失败。证据:`.work/G-01-r1/linux-mutation-tests.log`、`linux-probe-baseline-tests.log`、`linux-probe-mutant-tests.log`。探针副本及独立构建目录已删除。
+1
View File
@@ -0,0 +1 @@
PASS