Skip to content

feat(lfs): add git LFS read-only support (pointer resolution + batch download)#34

Merged
mizchi merged 9 commits intomainfrom
codex/flaker-git-compat
Apr 4, 2026
Merged

feat(lfs): add git LFS read-only support (pointer resolution + batch download)#34
mizchi merged 9 commits intomainfrom
codex/flaker-git-compat

Conversation

@mizchi
Copy link
Copy Markdown
Member

@mizchi mizchi commented Apr 4, 2026

Summary

  • Native LFS pointer file parsing — detects and parses version https://git-lfs.github.com/spec/v1 blobs
  • LFS URL resolution from lfs.url, remote.<name>.lfsurl, or derived from remote URL
  • LFS Batch API client — POST /objects/batch for download URLs, parse responses
  • Concurrent object download (8 parallel) to .git/lfs/objects/ cache
  • Prefetch integration — walks target tree before checkout, batch-downloads missing LFS objects
  • Checkout integration — replaces LFS pointer blobs with cached real content during worktree write
  • Removes filter=lfs startup block — LFS repos no longer rejected

No git-lfs binary dependency. bit handles LFS natively.

Scope: Read-only (clone/checkout). Write operations (push/clean) are out of scope.

Test plan

  • 15 unit tests for pointer parser + URL resolution (src/lib/lfs_wbtest.mbt)
  • 5 unit tests for batch API JSON serialization/parsing (src/lib/native/lfs_client_wbtest.mbt)
  • moon check --deny-warn passes for native and JS targets
  • 261 existing lib tests still pass
  • CI: JS Build
  • CI: Native test
  • CI: Git Compat Randomized
  • Manual: clone a GitHub repo with LFS files, verify real content

🤖 Generated with Claude Code

test and others added 9 commits April 4, 2026 17:34
Implements `is_lfs_pointer`, `parse_lfs_pointer`, and `lfs_object_path`
in `src/lib/lfs.mbt` with 8 passing unit tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Validate that the OID contains only valid hex characters (in addition to length == 64) in parse_lfs_pointer. Add two wbtest cases: wrong version and non-hex OID.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements lfs_prefetch_for_checkout in src/lib/native/lfs_prefetch.mbt:
walks a commit tree, identifies uncached LFS pointer blobs via gitattributes
filter=lfs, resolves the LFS URL, runs a batch download request, and
downloads missing objects to .git/lfs/objects/. Also adds @stdio import to
native lib moon.pkg for stderr warning output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…FS block

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Insert best-effort LFS prefetch calls in checkout_with_promisor_retry
and checkout_with_promisor_retry_clone before the retry loop, and make
resolve_checkout_common_git_dir public in src/lib/checkout.mbt.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mizchi mizchi merged commit 71dde32 into main Apr 4, 2026
13 checks passed
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