Skip to content

Stop rejecting .svg and .raw by extension - #135

Merged
Shengyu Fu (shengyfu) merged 1 commit into
microsoft:mainfrom
tenequm:fix/svg-raw-extensions
Sep 5, 2026
Merged

Shengyu Fu (shengyfu) merged 1 commit into
microsoft:mainfrom
tenequm:fix/svg-raw-extensions

Conversation

@tenequm

Copy link
Copy Markdown
Contributor

The walk rejects a list of binary extensions before reading file contents.
filetypes.rs defines svg as a builtin file type, so tgrep -t svg needle .
cannot match while rg -t svg needle . does. This removes .svg and .raw
from that list. The other 65 entries are still rejected on traversal.

svg_and_raw_are_classified_by_content_on_both_search_paths in
tgrep-cli/tests/ripgrep_parity.rs pins this on the indexed and brute-force
paths, and includes a .raw fixture containing a NUL that stays invisible on
traversal. Behaviour was compared against rg 15.2.0.

The walk rejects a list of binary extensions before reading file contents.
Two entries on that list cost matches ripgrep finds. filetypes.rs defines
`svg` as a builtin file type, so `tgrep -t svg needle .` cannot match while
`rg -t svg needle .` does.

Remove those two entries. The remaining 65 extensions are still rejected on
traversal, and a binary `.raw` stays invisible on traversal, matching
rg 15.2.0.
Copilot AI balanced review requested due to automatic review settings September 4, 2026 20:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The reviewed changes have regression coverage and no unresolved issues.

Pull request overview

Removes extension-only rejection of SVG and RAW files so content determines binary status.

Changes:

  • Allows .svg and .raw files through traversal.
  • Adds indexed and brute-force regression coverage.
File summaries
File Description
tgrep-core/src/walker.rs Removes SVG and RAW from binary-extension filtering.
tgrep-cli/tests/ripgrep_parity.rs Tests content classification and ripgrep parity.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@shengyfu
Shengyu Fu (shengyfu) merged commit 3d30656 into microsoft:main Sep 5, 2026
1 check passed
@tenequm
Misha Kolesnik (tenequm) deleted the fix/svg-raw-extensions branch September 5, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants