From 7b2c020a08b3b9f291ba14c71b5fbb5693b6cf6f Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 20:16:38 +0200 Subject: plan 8: generated apply and undo round trip; undo reverses chains within one file --- internal/engine/apply.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'internal/engine/apply.go') diff --git a/internal/engine/apply.go b/internal/engine/apply.go index 878cb18..ce05636 100644 --- a/internal/engine/apply.go +++ b/internal/engine/apply.go @@ -476,6 +476,15 @@ func planUndoFile(file string, ents []journal.Entry) UndoFile { break } step := reverseStep(en) + if (en.Action == "move" || en.Action == "rename") && proj.occupied[en.Dst] { + // A reversal already queued for this same file puts it back at + // en.Dst before this one runs, and that reversal was checked + // against the disk itself. Judged against the disk as it is now, + // en.Dst is empty - a later step of the chain moved the file on - + // and every rename-then-move, move-then-move or move-then-trash + // chain would be refused (plan 8, found by the property test). + step.Refused = "" + } if step.Refused == "" { step.Refused = refuseIfSrcExists(step, proj) } -- cgit v1.3