You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.thvignore directory patterns with wildcards never match #7182
A .thvignore directory pattern (one ending in /) that contains a wildcard never matches anything, so the directories it is meant to hide stay visible in the container. The same pattern without the trailing slash works.
getMatchingPaths in pkg/ignore/processor.go only checks a directory pattern as a literal path (os.Stat) and returns early; the filepath.Glob fallback is reached only by patterns without a trailing slash.
Steps to reproduce
In a directory to be mounted, create secrets-prod/ and secrets-dev/.
Add secrets-*/ to its .thvignore (or to ~/.config/toolhive/thvignore).
thv run <server> -v <dir>:/workspace.
Expected behavior
/workspace/secrets-prod and /workspace/secrets-dev are overlaid with empty directories, as they are for secrets-* or secrets-prod/.
Actual behavior
No overlay is created for them; GetOverlayMounts returns nothing for the pattern, and the directories' contents are visible in the container. Common .gitignore-style entries such as *.egg-info/ are affected the same way.
I have a fix ready and will open a PR: directory patterns go through the same literal-then-glob lookup as other patterns, and the glob results are filtered to directories. Fuller gitignore semantics (matching at any depth, **, !) are out of scope for it.
I'd like to work on this. The bug is in getMatchingPaths (pkg/ignore/processor.go): a directory pattern ending in / is only checked as a literal path (os.Stat) and returns early, so the filepath.Glob fallback is never reached for wildcard patterns like secrets-*/ or *.egg-info/. The fix is to fall through to glob (with the trailing slash trimmed) when the literal directory doesn't exist, plus a regression test. Could you assign the issue to me?
There's already a PR for this: #7183. It globs a pattern ending in / with the slash trimmed and keeps only the directories it matches, so secrets-*/ and *.egg-info/ work, and it adds regression tests. It's waiting for review.
Activity
HankGrimm commentedon Nov 24, 2026
I'd like to work on this. The bug is in
getMatchingPaths(pkg/ignore/processor.go): a directory pattern ending in/is only checked as a literal path (os.Stat) and returns early, so thefilepath.Globfallback is never reached for wildcard patterns likesecrets-*/or*.egg-info/. The fix is to fall through to glob (with the trailing slash trimmed) when the literal directory doesn't exist, plus a regression test. Could you assign the issue to me?mansur-akhmadi commentedon Nov 24, 2026
There's already a PR for this: #7183. It globs a pattern ending in
/with the slash trimmed and keeps only the directories it matches, sosecrets-*/and*.egg-info/work, and it adds regression tests. It's waiting for review.Match .thvignore wildcard directory patterns (stacklok#7258)