Repository navigation
Match glob directory patterns in .thvignore - #7183
Closed
mansur-akhmadi wants to merge 1 commit into
Closed
mansur-akhmadi wants to merge 1 commit into
mansur-akhmadi wants to merge 1 commit into
Conversation
A .thvignore pattern ending in "/" was only checked as a literal path, so a directory pattern with a wildcard such as "secrets-*/" or "*.egg-info/" never matched and the directories stayed visible in the mount. Directory patterns now go through the same glob fallback as other patterns, keeping only directories. Signed-off-by: Mansur Akhmadi <[email protected]>
mansur-akhmadi
force-pushed
the
fix/thvignore-dir-glob
branch
from
November 24, 2026 18:58
7ed8bf1 to
5f9374a
Compare
Contributor
|
Thanks for picking this up, and sorry this one sat. #7258 fixed the same bug from #7182 and was merged today. It takes the same approach: glob the trimmed pattern and keep only directories. So I'm closing this as a duplicate. Your PR came in first, and the review order wasn't fair to you. Thanks for the clean fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A
.thvignorepattern ending in/was only checked as a literal path, so a directory pattern with a wildcard (secrets-*/,*.egg-info/) never matched and those directories stayed visible in the mount, while the same pattern without the slash worked.getMatchingPathsnow handles directory patterns with the same literal-then-glob lookup as other patterns, and keeps only directories from the glob results.Fixes #7182
Type of change
Test plan
Unit tests (
task test)E2E tests (
task test-e2e)Linting (
task lint-fix)Manual testing (describe below)
New table test
TestGetMatchingPathsDirectoryPattern: glob matching several directories, glob matching only a file, glob matching nothing, literal file under a directory pattern, literal name with glob metacharacters (both a directory and a file), malformed glob. On main the glob case fails ([]string(nil)instead of the three directories); with the fix all pass.go test -race -count=3 ./pkg/ignore/, plus./pkg/container/docker/ ./pkg/container/runtime/ ./pkg/runtime/: ok.golangci-lintv2.15.0 (the CI version) on./pkg/ignore/...: 0 issues;go vet,gofmt: clean. I ran the package-scoped commands rather than the fulltask test/task lint.Does this introduce a user-facing change?
Yes. Before: a
.thvignoredirectory pattern with a wildcard hid nothing. After: it hides every matching directory at the top level of the mount (files matching it are left alone).Special notes for reviewers
Not changed here: patterns still match only at the top level of the mount, without
**or!support, as before.