aboutsummaryrefslogtreecommitdiff
path: root/internal/engine/apply.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 20:16:38 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 20:16:38 +0200
commit7b2c020a08b3b9f291ba14c71b5fbb5693b6cf6f (patch)
tree51dd0d05a7a7d14bcf344adf67bc418d061e92c2 /internal/engine/apply.go
parent754f362da077b06420ab8350dfb62bd2d8d89d75 (diff)
downloadkrino-7b2c020a08b3b9f291ba14c71b5fbb5693b6cf6f.tar.gz
krino-7b2c020a08b3b9f291ba14c71b5fbb5693b6cf6f.zip
plan 8: generated apply and undo round trip; undo reverses chains within one file
Diffstat (limited to 'internal/engine/apply.go')
-rw-r--r--internal/engine/apply.go9
1 files changed, 9 insertions, 0 deletions
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)
}