From 166565025832c8a8faf7397766aeaa878980dd2d Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 23:42:35 +0200 Subject: a real run's later directories are not blocked by earlier claims; -n across directories documented --- cmd/krino/sort.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'cmd/krino/sort.go') diff --git a/cmd/krino/sort.go b/cmd/krino/sort.go index 637587d..f600475 100644 --- a/cmd/krino/sort.go +++ b/cmd/krino/sort.go @@ -119,10 +119,11 @@ func cmdSort(g *globals, names []string, stdout, stderr io.Writer) int { exit := 0 printed := false jsonDirs := []plan.JSONDir{} // never nil: the document's "dirs" must marshal as [], not null - // A3: one Claims for the whole run, shared across every directory's - // Plan call below, so two directories that both plan a move to the - // same destination resolve the collision at planning time instead of - // each independently believing it owns that path. + // A3: in a dry run one Claims is shared across every directory's Plan + // call below, so two directories that both plan a move to the same + // destination resolve the collision at planning time instead of each + // independently believing it owns that path. A real run applies each + // directory before planning the next and starts fresh claims after it. claims := plan.NewClaims() for _, d := range e.Dirs { @@ -281,6 +282,14 @@ func cmdSort(g *globals, names []string, stdout, stderr io.Writer) int { if quit { break } + if !g.dry { + // This directory is applied (or skipped) now, so the disk is the + // truth for the next one: its claims - sources it moved away, + // destinations it planned but declined or failed - must not + // block a later directory (triage 28i). A dry run applies + // nothing, so there they carry over. + claims = plan.NewClaims() + } } if g.json { -- cgit v1.3