Skip to content

Apply Git clean filters to working-tree files - #61

Merged
thesiti92 merged 1 commit into
mainfrom
fix/worktree-clean-filter
Sep 30, 2026
Merged

thesiti92 merged 1 commit into
mainfrom
fix/worktree-clean-filter

Conversation

@thesiti92

Copy link
Copy Markdown
Contributor

Working-tree sides were read as raw bytes, so with core.autocrlf=true a CRLF checkout was compared against LF blobs. Tree-sitter languages hid it (atoms drop \r), but plain-text files such as Markdown fell back to the line diff and showed every line as changed (devdotfast/whiteboard#805).

Working-tree files now go through libgit2's blob_path, which applies Git's clean filters (autocrlf, eol, ident) like git diff. A mempack backend on the session repository keeps those blobs out of .git/objects.

  • New test in tests/view.rs: autocrlf repo, CRLF Markdown working copy, one line changed.
  • Cost: ~0.05 ms per working-tree file (2,000 modified files: 0.36 s → 0.47 s). Filtered blobs not already in the odb stay in memory for the run.

Working-tree sides were read as raw bytes, so under core.autocrlf a CRLF
checkout compared against LF blobs. Plain-text files (e.g. Markdown) then
showed every line as changed.
@thesiti92
thesiti92 enabled auto-merge (squash) September 30, 2026 19:42
@thesiti92
thesiti92 merged commit ec02c4d into main Sep 30, 2026
46 checks passed
thesiti92 added a commit to devdotfast/whiteboard that referenced this pull request Sep 30, 2026
Fixes #805.

diffr 0.1.8 (devdotfast/diffr#61) reads working-tree files through Git's
clean filters. Under `core.autocrlf=true`, a CRLF checkout was compared
raw against LF blobs, so plain-text files such as Markdown showed every
line as changed.

- Pin `@dev.fast/diffr` 0.1.8 in Review, Desktop and review-protocol;
update the lockfile and release-age exception.
- diffr 0.1.8 removed `--config`: the summarizer test writes
`diffr/config.toml` under a temp dir and sets `XDG_CONFIG_HOME` to it.
The fake diffr in `diffr-config.test.ts` follows.

Validation:
- Issue repro through `structuralDiff` (worktree comparison): `notes.md`
200/200 changed lines on 0.1.7, 0 lhs / 1 rhs on 0.1.8; right side no
longer carries `\r`.
- 14 bundled-diffr integration tests against the fetched 0.1.8 release;
review-protocol tests (59); diffr-config and structural-diff tests; root
lint and format; typecheck for review, review app and review-protocol;
Desktop protocol sync unchanged.
- No native Desktop UI run.
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.

2 participants