Skip to content

feat(git): 以已审阅提交保护强制删除,并保留首次追加多选 - #132

Merged
xiaoyumuxi merged 1 commit into
mainfrom
feat/git-force-delete-confirm
Nov 20, 2026
Merged

xiaoyumuxi merged 1 commit into
mainfrom
feat/git-force-delete-confirm

Conversation

@xiaoyumuxi

Copy link
Copy Markdown
Contributor

关联 Issue

Refs 1lck/Lithe-IDEA#2233

类型

  • feat:Git 显式强制删除及主修饰键多选改进

改动说明

普通删除遇到未完全合并的本地分支时保留分支,返回稳定码 git_branch_not_merged,并在 details 中返回分支名和完整提交 ID,供宿主展示风险和目标列表、二次确认。

  • git.write/deleteBranch 新增 expectedTarget;force: true 必须携带已审阅的完整 40/64 位对象 ID。分支已移动则以 git_branch_changed 拒绝。
  • 强制仅跳过合并检查,继续拒绝当前分支及任意 worktree 中检出的分支;沿用带 expected OID 的 update-ref -d 原子删除、恢复目标与分支配置清理。
  • 更新共享契约与删除 fixture;真实 Git 仓库测试覆盖普通拒绝、缺失/非法 expectedTarget、强制成功、恢复记录、变更目标和 worktree 占用。
  • 修复共享 workspace.rowSelection.reduce:先普通点击 A,再 Cmd/Ctrl 点击 B 时保留 A/B;首次点击已选行可取消它,根节点仍受保护。修复前 fixture 明确失败,修复后通过。Git 列表、项目树等共享消费者使用同一规则。

宿主负责独立风险确认、默认取消、混合多选只重试未合并项、失败分支名标红。本 PR 不新增插件宿主方法、SDK 或协议版本,不含平台 UI、发布或自动合并操作。

验证

  • cargo test --manifest-path rust/Cargo.toml -p lithe-core --lib branch_force_delete -- --test-threads=1:2 项通过。
  • cargo test --manifest-path rust/Cargo.toml -p lithe-core --lib shared_row_selection_fixture -- --test-threads=1:共享 fixture 全案例通过;修改前先观察到失败。
  • 原删除恢复记录回归 git_write_records_the_deleted_branch_target 通过。
  • cargo test --manifest-path rust/Cargo.toml -p lithe-git -p lithe-protocol -p lithe-row-selection -- --test-threads=1:157 + 8 + 2 项通过。
  • 相同三 crate 的 cargo clippy --all-targets -- -D warnings、workspace fmt check、注释规范、平台测试放置检查通过。
  • 宿主链接本地 Core 的真实 Git / Viva 无头定向测试和 race 检查通过,包括混合批量和主修饰键鼠标交互。
  • 未本地运行全 workspace 测试,交由 CI;未执行 Windows 原生交互验收。本次无 Windows 专属实现变化。

范围检查

  • 共享规则与契约在 Core,UI 仅呈现与输入。
  • 测试使用真实 Git 临时仓库和共享 fixture,无具体插件依赖。
  • Git 请求/进程沿用统一执行轨迹,未新增日志旁路或敏感输出。
  • 没有新增轮询、缓存、依赖或运行时资源写入。
  • Draft 提交,不触发合并。

Return structured unmerged and changed-target errors, require expectedTarget for force deletion, and preserve worktree and atomic ref protections. Keep the selected row when starting Cmd/Ctrl multi-selection.
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 20, 2026 10:00
@xiaoyumuxi
xiaoyumuxi merged commit 4ef9d9e into main Nov 20, 2026
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant