Skip to content

fix(file): file target bug with searchpattern and matchpattern#7629

Merged
olblak merged 3 commits intoupdatecli:mainfrom
josill:fix/file-target-bug-2
Jan 29, 2026
Merged

fix(file): file target bug with searchpattern and matchpattern#7629
olblak merged 3 commits intoupdatecli:mainfrom
josill:fix/file-target-bug-2

Conversation

@josill
Copy link
Contributor

@josill josill commented Jan 29, 2026

Fix #1860

Fix inconsistent behavior when using searchpattern: true with matchpattern where no files match the content pattern.

Changes

  • Fixed: When searchpattern: true is used with matchpattern and all files are filtered out (no matches), the target now returns an error instead of silently skipping
  • Consistency: Both searchpattern: false and searchpattern: true now fail consistently when no files match the pattern

Test

To test this pull request, you can run the following commands:

cd pkg/plugins/resources/file
go test -v

Additional Information

Tradeoff

The change modifies behavior for users who relied on the previous silent skip when no files matched with searchpattern: true. However, this was inconsistent with the behavior when searchpattern: false, and the issue maintainer confirmed this was a bug that should be fixed.

Potential improvement

A future enhancement could add a matchatleast parameter to allow specifying a minimum number of files that must match before the operation succeeds, providing more flexibility for users who need partial matching scenarios.

@josill josill force-pushed the fix/file-target-bug-2 branch from 70e2f4d to 24bee26 Compare January 29, 2026 09:15
@josill josill changed the title Fix/file target bug 2 fix: file target bug with searchpattern and matchpattern Jan 29, 2026
@josill josill marked this pull request as ready for review January 29, 2026 09:16
@josill
Copy link
Contributor Author

josill commented Jan 29, 2026

Sorry for the confusion I closed my previous PR and opened a new one because of the unrelated changes that I needed to revert. Tried to revert them with AI but that was a bad idea and screwed up the branch history. Did this manually now and fixed the comments from the CR: #7614

@olblak
Copy link
Member

olblak commented Jan 29, 2026

I understand could I ask you to cleanup the git history?
For example this commit 43b4999 is related to the pull request

#7613

@olblak
Copy link
Member

olblak commented Jan 29, 2026

You can easily do it using the git reset command before recreating the commits

@josill josill force-pushed the fix/file-target-bug-2 branch from 24bee26 to f8d19c4 Compare January 29, 2026 11:34
@josill josill force-pushed the fix/file-target-bug-2 branch from f8d19c4 to 2a42d26 Compare January 29, 2026 12:02
@josill
Copy link
Contributor Author

josill commented Jan 29, 2026

All fixed and thanks for the patience. Turns out my fork had commits in main that this repo didn't - my bad! Should be all good now!

Again, Ill turn more attention to the CR-s in the future.

@olblak olblak enabled auto-merge (squash) January 29, 2026 19:35
@olblak olblak added bug Something isn't working resource-file Resource of kind File labels Jan 29, 2026
@olblak olblak merged commit 35e90c4 into updatecli:main Jan 29, 2026
5 checks passed
@olblak olblak changed the title fix: file target bug with searchpattern and matchpattern fix(file): file target bug with searchpattern and matchpattern Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working resource-file Resource of kind File

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent behaviour of file target

2 participants