Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [1.10.5] - 2026-05-22

* Trim leading / trailing whitespace from each `--include` / `--exclude` pattern in `FilterOptions.AfterApply`. Multi-value env vars like `PISTA_INCLUDE="user*, posts"` were parsed by kong into `["user*", " posts"]`, and the leading space made `path.Match` treat the second pattern as ` posts` — silently matching nothing. The trim runs before `ValidatePatterns`, so the post-trim values are also what gets validated and what `MatchName` compares against.

## [1.10.4] - 2026-05-17

* Bind `apply --with-tx` to the `$PISTA_WITH_TX` environment variable so it can be enabled from CI / shell config without passing the flag on every invocation. Aligns with the existing `$PISTA_BULK_ALTER` / `$PISTA_DISABLE_INDEX_CONCURRENTLY` env-tag pattern on the other apply bool flags.
Expand Down
10 changes: 10 additions & 0 deletions filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ func TestFilterOptions_AfterApply_Invalid(t *testing.T) {
assert.Contains(t, err.Error(), "--include")
}

func TestFilterOptions_AfterApply_TrimsWhitespace(t *testing.T) {
o := &pistachio.FilterOptions{
Include: []string{" user* ", "\tposts\n"},
Exclude: []string{" tmp_* "},
}
require.NoError(t, o.AfterApply())
assert.Equal(t, []string{"user*", "posts"}, o.Include)
assert.Equal(t, []string{"tmp_*"}, o.Exclude)
}

func TestMatchName(t *testing.T) {
t.Run("no filters", func(t *testing.T) {
o := &pistachio.FilterOptions{}
Expand Down
7 changes: 7 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package pistachio
import (
"fmt"
"path"
"strings"
)

type Options struct {
Expand Down Expand Up @@ -63,6 +64,12 @@ func (f *FilterOptions) MatchName(name string) bool {
}

func (f *FilterOptions) AfterApply() error {
for i, pattern := range f.Include {
f.Include[i] = strings.TrimSpace(pattern)
}
for i, pattern := range f.Exclude {
f.Exclude[i] = strings.TrimSpace(pattern)
}
return f.ValidatePatterns()
}

Expand Down