From 3487ffcdf9ee29362bfd5beb6f4d4050b6deeace Mon Sep 17 00:00:00 2001 From: winebarrel Date: Fri, 22 May 2026 15:24:13 +0900 Subject: [PATCH 1/2] Trim whitespace from --include/--exclude patterns PISTA_INCLUDE/PISTA_EXCLUDE values are normalized in FilterOptions.AfterApply so leading/trailing whitespace around each pattern is stripped. Co-Authored-By: Claude Opus 4.7 (1M context) --- filter_test.go | 10 ++++++++++ options.go | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/filter_test.go b/filter_test.go index f6704c91..7d30a3d7 100644 --- a/filter_test.go +++ b/filter_test.go @@ -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{} diff --git a/options.go b/options.go index f66035d9..441a2b6d 100644 --- a/options.go +++ b/options.go @@ -3,6 +3,7 @@ package pistachio import ( "fmt" "path" + "strings" ) type Options struct { @@ -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() } From 2da6bf13ba9cb9fd03b1734c18b5970250e6ebe9 Mon Sep 17 00:00:00 2001 From: winebarrel Date: Fri, 22 May 2026 15:25:11 +0900 Subject: [PATCH 2/2] Add 1.10.5 changelog entry Co-Authored-By: Claude Opus 4.7 (1M context) --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 498117b8..b78cb1e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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.