aboutsummaryrefslogtreecommitdiff
path: root/cmd/krino/sort.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-15 00:41:00 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-15 00:41:00 +0200
commit2e812847572839e6c8097a7ecf5c4a469222087a (patch)
treef2c8908d235469dbdb4091984231d2ddb3beb3c8 /cmd/krino/sort.go
parent2a7452c3fd83000f239755825f38246f8537b6cc (diff)
downloadkrino-2e812847572839e6c8097a7ecf5c4a469222087a.tar.gz
krino-2e812847572839e6c8097a7ecf5c4a469222087a.zip
only where an earlier directory's files ended up stays claimed
Diffstat (limited to 'cmd/krino/sort.go')
-rw-r--r--cmd/krino/sort.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/cmd/krino/sort.go b/cmd/krino/sort.go
index b516629..aeeb1d4 100644
--- a/cmd/krino/sort.go
+++ b/cmd/krino/sort.go
@@ -264,12 +264,26 @@ func cmdSort(g *globals, names []string, stdout, stderr io.Writer) int {
}
res, aerr := e.Apply(ctx, toApply, approved, j, run)
if res != nil {
+ // Where files ended up: each copy, and the last place a
+ // move or rename put the file - not a path it passed
+ // through and left.
for _, fr := range res.Files {
+ final := ""
for _, sr := range fr.Steps {
- if sr.Status == "ok" && sr.Dst != "" {
+ switch {
+ case sr.Status != "ok":
+ case sr.Step.Kind == plan.DeletePermanent:
+ final = "" // gone: nothing is left anywhere
+ case sr.Dst == "":
+ case sr.Step.Kind == plan.Copy:
applied = append(applied, sr.Dst)
+ default:
+ final = sr.Dst
}
}
+ if final != "" {
+ applied = append(applied, final)
+ }
}
}
if aerr != nil {