`-T rust -t rust` still excludes Rust files instead of honoring the later type selection
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Read tgrep-core/src/filetypes.rs around line 167 and tgrep-cli/src/search.rs around line 2233 to trace how selected and excluded type lists reach the filter. Reproduce the argument-order cases from the issue, then check content search and --files in scanned and indexed modes. Done means a later -t selection overrides an earlier -T exclusion for the same type, with both argument orders covered by regression tests.
索引モデルが issue の本文から書いたものです。
説明
Summary
For conflicting -t and -T selections of the same file type, tgrep always gives exclusion precedence. ripgrep honors the later selection. Consequently, -T rust -t rust silently omits Rust files that ripgrep admits.
The same difference is visible in --files, which exits 0 even though its output is incomplete.
Reproduce
mkdir repro-type-order && cd repro-type-order
mkdir data
printf 'needle\n' > data/a.rs
printf 'needle\n' > data/a.txt
tgrep --no-index -T rust -t rust -l -- needle data
rg -T rust -t rust -l -- needle data
tgrep --no-index --files -T rust -t rust data
rg --files -T rust -t rust data
# Reverse-order control: both tools exclude Rust files
tgrep --no-index -t rust -T rust -l -- needle data
rg -t rust -T rust -l -- needle data
| Case | Actual: tgrep 1.2.0 | Expected: rg 15.1.0 |
|---|---|---|
-T rust -t rust content search |
No stdout, exit 1 | data/a.rs, exit 0 |
--files -T rust -t rust |
No stdout, exit 0 | data/a.rs, exit 0 |
Control: -t rust -T rust content search |
No stdout, exit 1 | No stdout, exit 1 |
The content-search cases reproduce with --no-index, an on-disk index, and tgrep serve --no-watch.
To repeat the indexed cases, run tgrep index data, remove --no-index, and keep the directory path data. For the server cases, start tgrep serve --no-watch data in another terminal and repeat those directory searches. --stats was used in the Windows harness to verify the selected backend, including (via server).
--files was separately verified in scan and local-index modes.
Environment
- tgrep 1.2.0, official Windows x86_64 release.
- Source inspected at release commit
3ba6ee02537281b68ee1366bb40df9f8b7cc54f0. - Windows; test harness run with PowerShell 7.
- ripgrep 15.1.0 (af60c2de9d).
- Verified on 2026-10-12. The shell examples describe the same fixture bytes and arguments tested on Windows.
Cause
tgrep-core/src/filetypes.rs:167 checks the exclusion matcher first and returns false immediately when it matches. tgrep-cli/src/search.rs:2233 receives separate selected/excluded type lists, so it cannot resolve the conflicting selections using their original interleaving.
Possible fix
Preserve the ordering of -t and -T operations when constructing the filter. A later selection of a type should supersede an earlier exclusion of that same type, as in ripgrep.
A regression could cover both argument orders in content search and --files, across indexed and scanned paths.
- 主要言語
- Rust
- スター
- 3.4k
- フォーク
- 137
- 平均マージ
- 15時間 25分
- マージ済み PR(30日)
- 26
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/tgrep のほかの issue
microsoft/tgrep の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
EmbarkStudios/cargo-deny#910 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
tursodatabase/turso#10054 ·
メンテナーはふだん 1 日以内に返信
-
build: Update rust version対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdependencies
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
ibm-granite-community/granite-cli#229 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
orottier/web-audio-api-rs#658 ·