Skip to content

[ckpt] feat: diff -t 改为可选,支持快照与当前工作区比较 #846

@Ziqi002

Description

@Ziqi002

概述

ws-ckpt diff 目前要求同时传 -f(源快照)和 -t(目标快照),无法将快照与当前工作区状态进行比较。

改动方案

-t 改为可选。省略时,与当前工作区 subvolume 比较。

CLI:

# 现状(两个都必填)
ws-ckpt diff -w /path -f snap-1 -t snap-2

# 改动后(省略 -t → 与当前工作区比较)
ws-ckpt diff -w /path -f snap-1

实现要点:

  • CLI:Diff variant 中 to: Stringto: Option<String>crates/cli/src/main.rs:194
  • 协议:Request::Diff.to 改为 Option<String>
  • Daemon dispatcher:toNone 时,用 live workspace subvolume 路径(data_root.join(ws_id))作为目标传给 btrfs send -p
  • btrfs send --no-data -p <snapshot> <live_subvol> 只读元数据,需验证对非只读 subvolume 是否正常工作
  • SKILL.md 同步更新,标注 -t 为可选

使用场景

用户想看自上次 checkpoint 以来改了什么,不应该需要先创建一个新快照才能 diff。"跟上次存档比有什么变化"是最自然的 diff 操作。

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions