Skip to content

Add whole-line grep and Git repository search and inspection - #1525

Merged
zechengz merged 5 commits into
mainfrom
codex/grep-git-inspection
Oct 9, 2026
Merged

zechengz merged 5 commits into
mainfrom
codex/grep-git-inspection

Conversation

@zechengz

@zechengz zechengz commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Agents inspecting repositories currently hit unsupported commands and options for whole-line grep, historical Git search, tree listings, binary diffs and unreachable objects. This adds all five capabilities in Python and TypeScript using existing search matchers, repository readers, patch rendering and fsck validation.

  • Support grep and zgrep -x/--line-regexp, including cross-mount searches and native-search fallback.
  • Add git grep for tracked working files, cached index blobs and revisions, and git ls-tree with recursive, directory, filename-only and NUL output.
  • Implement -a/--text across the diff family and log -G, preserving raw bytes, binary statistics and native combined-diff behavior.
  • Implement fsck --unreachable with rooted traversal, independently of dangling-tip reporting.

Git search reuses the existing blob readers and tree resolution; flattened and listed trees share traversal. Index and tree listing handlers live together in the existing listing module. Coverage extends the existing native-Git command matrix and existing parameterized unit suites, with shared integration goldens for the reported failures. No new unit-test files or functions are added.

Validation:

  • Existing Git unit suites: 2,217 Python and 1,907 TypeScript tests passed.
  • Existing parser suites: 211 Python and 235 TypeScript tests passed. Their unknown-option case now uses -Q, since -x is supported.
  • All 998 shared Git integration cases passed on each host with identical outputs; compact grep/zgrep/cross-mount coverage passed 14 runs per host.
  • Native comparisons against Git 2.50.1, Debian Git 2.47.3, and pinned GNU grep 3.11. All 21 shared search/binary cases and five consolidated grep cases match byte for byte.
  • Full TypeScript build and typecheck, repository-wide pre-commit, layout/symbol/spec parity, source-to-test mirroring and barrel-surface checks.

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5 Tier: apex

[Medium impact] The PR appears safe to merge; the earlier word-search slowdown is fixed.

Summary

Adds whole-line grep/zgrep, Git searches and tree listings, text patches for binary files, and unreachable-object reports in both languages.

  • grep and zgrep can select lines that match from start to finish.
  • git grep searches tracked files and stored repository content.
  • git ls-tree lists files and folders stored in a revision.
  • Git diff commands can render binary blobs as text and log -G can search them.
  • git fsck --unreachable reports objects outside the repository's rooted history.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  G["git grep"] --> S{"Content source"}
  S -->|Working tree| W["Read tracked working files"]
  S -->|--cached| I["Read index blobs"]
  S -->|Revision| R["Read stored blobs"]
  W --> M["Match lines with prepared patterns"]
  I --> M
  R --> M
  M --> O["Render results and set exit status"]
Loading

Reviews (3) · Last reviewed commit: "Compile Git word matchers once per patte..." · Reviewed by Greptile

Comment thread python/mirage/commands/cli/builtin/git/pickaxe.py
Comment thread typescript/packages/core/src/commands/cli/builtin/git/pickaxe.ts
Comment thread python/mirage/commands/cli/builtin/git/grep.py Outdated
Comment thread python/mirage/commands/cli/builtin/git/grep.py
Comment thread python/mirage/commands/cli/builtin/git/grep.py Outdated
Comment thread typescript/packages/core/src/commands/cli/builtin/git/grep.ts Outdated
@zechengz
zechengz merged commit 6f50ffa into main Oct 9, 2026
62 checks passed
@zechengz
zechengz deleted the codex/grep-git-inspection branch October 9, 2026 04:32
zechengz added a commit that referenced this pull request Oct 9, 2026
git grep and ls-files (#1525) take inv.view. Rewords four phrases the
rename broke (command-entry point guard, ops-entry point, ...), and TS
archive extract imports StatFn from walk as python does.
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.

1 participant