Artifact b9343919d43829109b5d7f098d4122e88f951189b1498db79a17810b752134af:
- File
internal/checkout/revert_undo_js.go
— part of check-in
[80764da743]
at
2026-10-19 20:09:26
on branch feat/submanifest-reader
— fix(checkout): revert renames onto taken names, saving undo first
Checkout.Revert refused to undo a rename when another file held the old name: a swap, a chain, a new add or an untracked file there. Like fossil's revert it now saves each file it writes or deletes for undo, then reverts in one transaction, so Undo or fossil undo brings back what it overwrote, and a failed revert puts the files back.
Undoing a rename takes back the old name from whatever row holds it: a row renamed onto it is reverted to its own old name, and any other row is dropped, as fossil's UPDATE OR REPLACE drops it. Every committed file ends under its committed name; fossil's own revert leaves a swap renamed and stops tracking the second file of a chain.
Tracked in #248. (user: [email protected], size: 446) [annotate] [blame] [check-ins using] [more...]
//go:build js package checkout import "database/sql" // revertUndo is empty under js/wasm, which has no undo package: Revert // saves no undo state there, and cannot put files back after a failure. type revertUndo struct{} func (c *Checkout) readRevertUndo([]revertStep) (revertUndo, error) { return revertUndo{}, nil } func (revertUndo) save(*sql.Tx) error { return nil } func (c *Checkout) rollBackRevert(revertUndo) error { return nil }