From 356af44c5a430cce8d79e0083f6668746ebdfb1f Mon Sep 17 00:00:00 2001 From: Quanyi Ma Date: Mon, 6 Jul 2026 16:27:40 +0800 Subject: [PATCH 1/4] fix(reset): support git-style bare path reset Signed-off-by: Quanyi Ma --- COMPATIBILITY.md | 2 +- docs/commands/reset.md | 21 ++- docs/commands/zh-CN/reset.md | 21 ++- docs/development/commands/reset.md | 4 +- .../_parameter-tables.md | 2 +- .../cli.restore-reset-diff.md | 4 +- src/cli.rs | 75 ++++++++++ src/command/cherry_pick.rs | 3 +- src/command/reset.rs | 139 +++++++++++++++--- src/internal/ai/review/launcher.rs | 1 + tests/command/reset_test.rs | 112 ++++++++++++-- 11 files changed, 336 insertions(+), 48 deletions(-) diff --git a/COMPATIBILITY.md b/COMPATIBILITY.md index 70d72a82f..304a03636 100644 --- a/COMPATIBILITY.md +++ b/COMPATIBILITY.md @@ -71,7 +71,7 @@ batch document. | merge | partial | fast-forward and single-head three-way merge supported; `-m `, `--ff-only`, `--no-ff`, `--squash`, `--no-commit`, `--no-edit` (accepted no-op; Libra never opens an editor for merge), `--stat`/`-n`/`--no-stat` (last-wins toggle; `--stat` prints a post-merge diffstat of the merge's changes, the default is no diffstat), `--no-progress` (accepted no-op; Libra's merge renders no progress meter), `--verify-signatures` (verify the merged tip's PGP signature against the local vault key — like `tag -v`, only signatures made by this repository's vault key can be validated; no external keyring) / `--no-verify-signatures` (the default; toggle pair, last wins), `--no-rerere-autoupdate` (accepted no-op — never auto-stages replayed resolutions; rerere IS auto-integrated when `rerere.enabled` is set, with staging following `rerere.autoUpdate` since merge does not expose the positive `--rerere-autoupdate`), and `--no-gpg-sign` (accepted no-op; Libra's merge never signs the merge commit) supported; the `merge.conflictStyle` config (`merge` default / `diff3` adds the `||||||| base` ancestor block to line-level text conflicts; honored by merge and cherry-pick; an unsupported value such as `zdiff3` is a hard error when a conflict must be rendered, exit 128) supported; Libra extensions: `--dry-run` (preview the outcome writing nothing — no HEAD/index/worktree/state/object write; exit 0 clean, exit 1 would-conflict with `would_conflict`+`conflicted_paths` in `--json`) and `--restart` (abort the in-progress conflicted merge — discarding resolution work like `--abort` — then re-run the same merge against the recorded target commit; original merge options not replayed); octopus/custom strategies, `--rerere-autoupdate`, and `-S`/`--gpg-sign` (signing the merge commit) deferred; `--autostash`/`--no-autostash` + `merge.autostash` config (lore.md 1.8, Git-faithful): a dirty tree (tracked changes incl. staged) is stashed into a HELD commit before the merge (not in `stash list` — the MERGE_AUTOSTASH model, sidecar `merge-autostash.json`), re-applied when the merge concludes (clean success, up-to-date, squash, start failure, `--continue`, `--abort`); a conflicted merge HOLDS it (also across `--restart` cycles); a conflicting re-apply promotes it into the stash list with a notice — changes are never lost; invalid `merge.autostash` is a hard error; JSON gains an additive `autostash: applied|stashed|kept` field lore.md 2.6: participates in the symmetric cross-op sequencer mutex — starting a `merge` is refused (`LBR-CONFLICT-002`) while any OTHER sequence is unresolved (and vice-versa). | | merge-base | partial | Prints the best common ancestor of two commits — a true LCA (a common ancestor that is not a strict ancestor of another), shared with `diff A...B` via `internal/merge_base.rs`; `--all` prints every lowest common ancestor, `--is-ancestor` tests ancestry (exit 0/1), `--json`/`--machine` supported. Exit 0 (base found / ancestry holds) / 1 (no common ancestor / not an ancestor; no output, matching Git) / 128 (unresolvable commit or wrong arg count). More than two commits, `--octopus`/`--independent`/`--fork-point` not exposed. `rebase` now computes its merge base through this shared LCA (no longer a first-found walk), and `log A...B` excludes the reachable-set intersection (correct for multiple merge bases) — the consolidation is complete | | merge-file | partial | File-level three-way merge of ` ` reusing the same `diffy` merge as `merge` (markers labelled `ours`/`theirs`, `||||||| original` with `--diff3`); `-p`/`--stdout`, `--diff3`, `-q`/`--quiet`, `--json`/`--machine` supported; works outside a repository. Exit 0 (clean) / 1 (conflict, fixed at 1) / 128 (missing/unreadable/binary input). In-place writes back up the original under `.libra/merge-file-backup/` (kept on conflict). `-L