aboutsummaryrefslogtreecommitdiff
path: root/cmd/krino/sort.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-15 00:26:36 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-15 00:26:36 +0200
commitf12f3f1356e4e96d419d66d13c2e67b73a50346f (patch)
treec3d83c41030b0fae8252cc18783c40fa9c8d0f9d /cmd/krino/sort.go
parent8a046c897e42e9459aa99377589c80c773601efc (diff)
downloadkrino-f12f3f1356e4e96d419d66d13c2e67b73a50346f.tar.gz
krino-f12f3f1356e4e96d419d66d13c2e67b73a50346f.zip
an earlier directory's applied results stay claimed for later ones
Diffstat (limited to 'cmd/krino/sort.go')
-rw-r--r--cmd/krino/sort.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/cmd/krino/sort.go b/cmd/krino/sort.go
index 5a175a4..b516629 100644
--- a/cmd/krino/sort.go
+++ b/cmd/krino/sort.go
@@ -151,6 +151,7 @@ func cmdSort(g *globals, names []string, stdout, stderr io.Writer) int {
continue
}
+ var applied []string // where this directory's applied steps put files
quit := func() bool {
defer func() {
if rerr := l.Release(); rerr != nil {
@@ -262,6 +263,15 @@ func cmdSort(g *globals, names []string, stdout, stderr io.Writer) int {
notReviewed = len(actionable) - len(reviewedChains(actionable, approved))
}
res, aerr := e.Apply(ctx, toApply, approved, j, run)
+ if res != nil {
+ for _, fr := range res.Files {
+ for _, sr := range fr.Steps {
+ if sr.Status == "ok" && sr.Dst != "" {
+ applied = append(applied, sr.Dst)
+ }
+ }
+ }
+ }
if aerr != nil {
// Interrupted mid-apply (fix round 2026-09-12/item 2):
// treated exactly like the cancelled lock wait above - not
@@ -290,9 +300,15 @@ func cmdSort(g *globals, names []string, stdout, stderr io.Writer) int {
// 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.
+ // block a later directory (triage 28i). What it did put
+ // somewhere stays claimed, so a later (on-conflict overwrite)
+ // takes a free name rather than trash this run's own result
+ // (plan 11 review M1). A dry run applies nothing, so there every
+ // claim carries over.
claims = plan.NewClaims()
+ for _, p := range applied {
+ claims.Claim(p)
+ }
}
}