Skip to content

fs: prune .git from grep and find; make grep -m count files - #29

Closed
mgasner wants to merge 1 commit into
fix/lsp-diagnosticsfrom
fix/fs-grep
Closed

mgasner wants to merge 1 commit into
fix/lsp-diagnosticsfrom
fix/fs-grep

Conversation

@mgasner

@mgasner mgasner commented Sep 28, 2026

Copy link
Copy Markdown

Stacked on #28. The diff shows only this change.

What was wrong

  • enumerate_paths walked with hidden(false). That correctly keeps dotfiles, but it also descended into .git, which contradicts docs/design/fs-grep.md.
  • GREP's default per-file cap was the page record limit, counted from the file's first match. A file with more matches than one page could hold silently lost the rest.
  • The CLI sent -m N as the page record limit and kept paging, so -m never limited anything. -m 1 failed with Invalid, and small pages hit the dropped-match bug.

Fix

  • .git: pruned by default. With --no-ignore it is walked and marked ignored.
  • Per-file cap: max_per_file = 0 now means no cap.
  • CLI paging:
    • It uses the default page size and stops after N matching files.
    • A file whose matches span pages is counted and printed once.
    • It warns about truncation only when the final page is truncated.

Testing

  • New tests: grep_default_per_file_cap_keeps_every_match_across_pages and grep_and_search_prune_git_metadata_unless_ignored_paths_are_included.
  • yas-server --lib yas_fs passes (13 tests).
  • Checked by hand:
    • -m 1 returns 1 file and -m 2 returns 2.
    • All 3 matches in one file are kept.
    • fs find HEAD doesn't find .git/HEAD.

View in Indent
Tag @indent to continue the conversation here.

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Coverage

Crate Lines Functions Regions
alacritty-driver 85.6% (1081/1263) 89.4% (84/94) 89.3% (1746/1955)
browser 25.5% (309/1212) 30.4% (34/112) 27.7% (605/2183)
cli 34.2% (6797/19893) 36.3% (644/1776) 35.3% (10102/28641)
client 68.1% (5785/8497) 68.4% (707/1033) 66.2% (7504/11331)
composite-transport 96.3% (526/546) 98.4% (60/61) 96.2% (884/919)
compositor 55.0% (11449/20820) 66.1% (836/1265) 54.8% (15853/28909)
desktop 78.4% (4460/5691) 71.6% (393/549) 75.1% (6211/8267)
edge 62.9% (798/1268) 50.9% (82/161) 57.7% (1038/1799)
fonts 77.3% (1257/1626) 82.7% (129/156) 78.9% (2424/3071)
fssync 85.5% (1601/1872) 85.4% (181/212) 86.7% (2821/3255)
git 73.1% (4636/6344) 70.5% (347/492) 70.3% (6609/9407)
guest 67.3% (6829/10148) 67.0% (488/728) 66.6% (8935/13416)
lsp 79.9% (3641/4558) 81.3% (340/418) 77.7% (5489/7068)
proxy 63.1% (1902/3012) 56.3% (184/327) 63.4% (2931/4626)
runtime-dir 93.6% (117/125) 100.0% (14/14) 94.8% (218/230)
sd-notify 73.9% (68/92) 100.0% (6/6) 83.2% (109/131)
server 71.5% (86359/120750) 74.1% (6266/8455) 69.5% (115683/166506)
ssh 67.2% (708/1054) 75.9% (85/112) 67.2% (1105/1645)
terminal-model 49.9% (314/629) 62.3% (38/61) 50.3% (505/1004)
uplink 94.2% (582/618) 92.6% (50/54) 93.1% (1062/1141)
webrtc-forwarder 33.6% (1321/3932) 44.9% (146/325) 36.0% (2279/6336)
webserver 80.7% (1490/1846) 81.1% (193/238) 83.2% (2551/3067)
website 35.1% (355/1012) 34.4% (53/154) 35.8% (607/1694)
xtask 0.0% (0/5149) 0.0% (0/131) 0.0% (0/9157)
yas 89.0% (28040/31522) 94.1% (2152/2286) 84.1% (44040/52388)
Total 67.2% (170425/253479) 70.3% (13512/19220) 65.5% (241311/368146)

@indent
indent Bot force-pushed the fix/lsp-diagnostics branch from 94eb579 to 0d04d90 Compare October 14, 2026 19:08
@indent
indent Bot force-pushed the fix/fs-grep branch 2 times, most recently from 0bbfcac to dcce491 Compare October 14, 2026 19:32
@indent
indent Bot force-pushed the fix/lsp-diagnostics branch 2 times, most recently from bc62863 to f6b8b37 Compare October 14, 2026 19:54
enumerate_paths walked with hidden(false), which keeps dotfiles as the
design wants but also descended into .git, so grep and find searched
repository metadata. .git is now pruned like an ignored directory, and
with ignored paths included it is walked and marked ignored
(docs/design/fs-grep.md).

GREP's default per-file cap was the page record limit and counted from
the first match, so a file with more matches than one page could hold
lost the rest even though the cursor resumed inside it. Zero now caps
nothing.

`yas fs grep -m N` sent N as the page record limit and kept paging, so it
never limited anything, -m 1 failed with Invalid, and small pages hit the
dropped-match bug above. It now uses the default page size and stops
after N matching files; a file split across pages counts and prints
once, and multi-page searches no longer warn that results were
truncated.
@indent
indent Bot force-pushed the fix/lsp-diagnostics branch from f6b8b37 to 974ee7b Compare October 15, 2026 01:43
@indent indent Bot closed this Oct 15, 2026
@indent
indent Bot deleted the fix/fs-grep branch October 15, 2026 13:07
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