diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-12 20:14:47 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-12 20:14:47 +0200 |
| commit | 3f8679be9373ee7508d512dfdfc1dda0839c7f90 (patch) | |
| tree | ec02eb075f6c4e90f21baa2fe674e86a2f7f6a62 /cmd/krino/render.go | |
| parent | 24a84671ace373ae331fa83a1ff484990f4dff0e (diff) | |
| download | krino-3f8679be9373ee7508d512dfdfc1dda0839c7f90.tar.gz krino-3f8679be9373ee7508d512dfdfc1dda0839c7f90.zip | |
krino: acting — trash, journal, apply, lock, review, undo
Diffstat (limited to 'cmd/krino/render.go')
| -rw-r--r-- | cmd/krino/render.go | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/cmd/krino/render.go b/cmd/krino/render.go index b27d4d1..de5489a 100644 --- a/cmd/krino/render.go +++ b/cmd/krino/render.go @@ -77,6 +77,25 @@ func printPlan(w io.Writer, dp *engine.DirPlan, verbose bool) { } } +// chainActing reports whether c has at least one step that will actually +// run - the single definition of "actionable" that countActing, +// actionableChains (sort.go) and chainOutcomes (sort.go) all share (fix +// wave item 4 / Minor 5). Before this fix, countActing and actionableChains +// each kept their own copy of this question and disagreed: countActing +// excluded an all-skipped chain (len(Steps) > 0, but every step's Skip is +// set) while actionableChains's own len(Steps) > 0 check included it, so a +// directory could print "N scanned · 0 to act on" and then still ask the +// user to approve a file it had just said there were none of - and on +// approval, log a run-start/run-end pair holding only "skipped" entries. +func chainActing(c plan.Chain) bool { + for _, s := range c.Steps { + if s.Skip == "" { + return true + } + } + return false +} + // countActing reports how many chains have at least one step that will // actually run. C1/ruling 2026-09-12: a rule with no actions is an // exclusion, and a chain every one of whose steps is skipped is not about @@ -84,11 +103,8 @@ func printPlan(w io.Writer, dp *engine.DirPlan, verbose bool) { func countActing(chains []plan.Chain) int { n := 0 for _, c := range chains { - for _, s := range c.Steps { - if s.Skip == "" { - n++ - break - } + if chainActing(c) { + n++ } } return n |
