fix: log skipped invalid gitignore patterns to stderr

Silent pass on re.error hid invalid .gitignore patterns from users,
making it impossible to diagnose unexpected file-exclusion behavior.
Now logs a warning to stderr so users can see which patterns were
skipped and why.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
claude[bot]
2026-04-21 12:28:26 +00:00
Unverified
parent 822b20d9bf
commit d919a0cf00
@@ -133,8 +133,8 @@ def parse_gitignore(project_root: Path) -> list[re.Pattern[str]]:
regex = regex.rstrip("/") + "(/|$)"
try:
patterns.append(re.compile(regex))
except re.error:
pass
except re.error as e:
print(f"Warning: skipping invalid gitignore pattern '{line}': {e}", file=sys.stderr)
return patterns