Repository navigation
git-rg v0.3.0
git-rg v0.3.0
v0.3.0 tightens completeness guarantees for remote commit search and reduces the local cost of cached and streamed scans. The CLI and NDJSON schema remain compatible with v0.2.0.
English
Immutable search scope
exactandautoresolve a branch, tag, or commit to one immutable commit and load its complete tree before declaring a result complete. An incomplete tree, failed pagination, or failed subtree retrieval cannot producecomplete=true.- Archive entries are checked against the Git blob object ID (
blob <size>\0plus the entry content). Archive omissions or rewrites caused byexport-ignore,export-subst, or Git LFS are supplemented from the blob API, while the immutable tree remains the search scope. automay use the provider index to accelerate candidate ordering, but it still verifies and scans the selected commit likeexact.indexedremains a candidate-only mode and is never evidence of complete repository coverage.
Search and cache path
- When explicit globs narrow the search, validated cached selected blobs are used first. Download limits apply only to cache misses.
- Cache probing is bounded: after more than eight misses, the remaining entries return to the usual archive/index strategy. Small eligible missing sets can use the bounded blob path; broad selections use the full archive scan.
- Windows cache readers and timestamp updates allow concurrent entry replacement while existing readers retain the complete previous contents.
- Tree JSON is decoded and glob-filtered as a stream. Matching is byte-oriented, reader/probe buffers are pooled, and glob segments are compiled once per query.
- Result events use a conservative 256 KiB memory budget per spool, then use a private temporary spool capped at 32 MiB. Temporary result files are removed after consumption.
- NDJSON output uses a 64 KiB writer and a 100 ms flush timer. Metadata, the first match, warnings, errors, and the summary are flushed promptly so a pipe can observe the first result without waiting for the whole scan.
CLI and migration
- NDJSON remains
schema_version: 1. Existing fields, types, exit codes, and the meanings ofcomplete,truncated, andreasonare unchanged. - The cache now uses v2
.entryobjects with an integrity header and SHA-256 protected payload. Older cache files are treated as misses and are not reused; the next query downloads valid objects again automatically. No CLI flag change is required. - Complete tree pagination counts toward
--max-requests. Large repositories may need a larger request budget forexactorauto. - With v0.3.0 current, v0.2.0 and v0.1.0 are EOL under SUPPORT.md; they remain available for reproduction and rollback only.
Release assets
The release contains six Tier 1 archives, install.sh, install.ps1, and checksums.txt:
git-rg_v0.3.0_linux_amd64.tar.gz, git-rg_v0.3.0_linux_arm64.tar.gz, git-rg_v0.3.0_darwin_amd64.tar.gz, git-rg_v0.3.0_darwin_arm64.tar.gz, git-rg_v0.3.0_windows_amd64.zip, and git-rg_v0.3.0_windows_arm64.zip.
Each archive has one top-level version directory and one platform binary. checksums.txt covers all six archives and both installers; verify it before extraction or execution. See installation.md for installation and rollback procedures.
Verification
The source has passed go test -race ./..., go vet ./..., and go build ./cmd/git-rg on OrbStack Linux arm64 with Go 1.26.1. Native CI and the Release workflow passed on all six platforms. Release checks include native version/help smoke tests, installation with the published scripts, real GitHub searches on every platform, and a real GitLab search on Linux amd64.
中文
不可变搜索范围
exact和auto会先把 branch、tag 或 commit 解析为一个不可变 commit,并读取完整 tree;tree 分页或 subtree 不完整时不会声明complete=true。- archive 条目按 Git blob OID(
blob <size>\0加正文)校验。export-ignore、export-subst或 Git LFS 导致的归档缺失、改写,会从 blob API 补齐;搜索范围仍以不可变 tree 为准。 auto可以利用 provider 索引加速候选排序,但最终仍按exact方式核验和扫描所选 commit。indexed只代表索引候选范围,未命中不能证明仓库没有匹配。
搜索与缓存路径
- 显式 glob 缩小搜索范围时,会先使用已验证的选中 blob 缓存,下载限制只作用于缓存未命中项。
- 缓存探测有界:未命中超过 8 个后,剩余条目交回原有 archive/索引策略;较小的缺失集合可走受限 blob 路径,大范围选择使用完整 archive 扫描。
- Windows 缓存读取与时间戳更新允许并发替换条目,已打开的读者仍能读取完整的旧内容。
- tree JSON 采用流式解码和 glob 筛选;匹配按字节处理,reader/probe buffer 复用,glob segment 在每次查询时预编译。
- 每个结果 spool 先使用 256 KiB 的保守内存字节预算,超出后写入私有临时文件,文件上限 32 MiB,消费完成后删除。
- NDJSON 使用 64 KiB 输出缓冲和 100 ms 刷新定时器;meta、首条 match、warning、error 与 summary 会及时刷新。
CLI、迁移与资产
- NDJSON 继续使用
schema_version: 1;字段、类型、退出码以及complete、truncated、reason的完整性含义保持不变。 - 缓存切换到带完整性校验的 v2
.entry格式。旧缓存不会复用,会按未命中自动重新拉取;无需修改 CLI 参数。 - 完整 tree 分页计入
--max-requests;大型仓库使用exact或auto时可能需要提高预算。v0.2.0 与 v0.1.0 按 SUPPORT.md 进入 EOL,仅保留复现和回滚用途。 - Release 提供 Linux、macOS、Windows 的 amd64/arm64 六个 archive、
install.sh、install.ps1和覆盖六个 archive 和两个安装器的checksums.txt。六平台原生 CI 和 Release 验证 已全部通过,包括原生版本/help 检查、发布脚本安装、全部平台的真实 GitHub 搜索,以及 Linux amd64 的真实 GitLab 搜索。
完整变更记录:v0.2.0...v0.3.0