summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 23:40:56 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 23:40:56 +0200
commitbb8b547023b0867f31d7452faceef5769a45b94b (patch)
tree9daf9efd0ac5336747483557976a83ac5725b956 /cmd
parentc09020c2fb01da24d5befbed78ce3b73b5efbe4c (diff)
downloadkrino-bb8b547023b0867f31d7452faceef5769a45b94b.tar.gz
krino-bb8b547023b0867f31d7452faceef5769a45b94b.zip
explain: shows a duplicate's skipped delete, leaves the cache alone, walks only for duplicate tests
Diffstat (limited to 'cmd')
-rw-r--r--cmd/krino/explain.go3
-rw-r--r--cmd/krino/sort_test.go6
2 files changed, 9 insertions, 0 deletions
diff --git a/cmd/krino/explain.go b/cmd/krino/explain.go
index 5f9f6de..f65df42 100644
--- a/cmd/krino/explain.go
+++ b/cmd/krino/explain.go
@@ -78,6 +78,9 @@ func cmdExplain(g *globals, args []string, stdout, stderr io.Writer) int {
fmt.Fprintf(stdout, "rule %s: %s\n", rt.Rule.Name, status)
printTrace(stdout, rt.Trace)
}
+ if x.NoDelete != "" {
+ fmt.Fprintf(stdout, "\nkrino would skip deleting this file: %s\n", display(x.NoDelete))
+ }
return 0
}
diff --git a/cmd/krino/sort_test.go b/cmd/krino/sort_test.go
index 321c9e8..12edb24 100644
--- a/cmd/krino/sort_test.go
+++ b/cmd/krino/sort_test.go
@@ -225,4 +225,10 @@ func TestDryRunShowsNeverDeletedSkip(t *testing.T) {
if !strings.Contains(out, "skipped: a duplicate is never deleted") {
t.Errorf("plan lacks the skipped delete:\n%s", out)
}
+ // explain shows it too, for the copy that is the duplicate (triage 30a).
+ _, outA, _ := runCLI(t, "explain", filepath.Join(dl, "a.pdf"))
+ _, outB, _ := runCLI(t, "explain", filepath.Join(dl, "b.pdf"))
+ if strings.Count(outA+outB, "a duplicate is never deleted") != 1 {
+ t.Errorf("explain should name the skipped delete for exactly one copy:\n%s\n%s", outA, outB)
+ }
}