aboutsummaryrefslogtreecommitdiff
path: root/cmd/krino/sort.go
diff options
context:
space:
mode:
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 {