Skip to content

UPSTREAM PR #2526: gix,gix-odb,gix-pack: stream blob contents from the ODB#45

Open
loci-dev wants to merge 6 commits into
mainfrom
loci/pr-2526-pr-1595
Open

UPSTREAM PR #2526: gix,gix-odb,gix-pack: stream blob contents from the ODB#45
loci-dev wants to merge 6 commits into
mainfrom
loci/pr-2526-pr-1595

Conversation

@loci-dev
Copy link
Copy Markdown

Note

Source pull request: GitoxideLabs/gitoxide#2526

Add streaming blob lookup support for loose and packed objects, avoid eagerly materializing packed results into memory, and expose repository helpers with regression coverage for loose, packed, empty, and wrong-type cases.

Addresses #1595.

Summary

This adds blob-only streaming reads from the object database so callers can obtain blob contents without first materializing the full object in memory.

At the repository level, this introduces blob streaming helpers that:

  • stream loose blobs directly
  • stream packed blobs through a tempfile-backed reader
  • reject non-blob object IDs
  • preserve the existing empty-blob fast path

Implementation

To support this, the change adds a streaming object path through the ODB stack.

Loose objects are exposed as a reader over incremental decompression.

Packed objects are decoded into a temporary file and then returned as a readable stream. This avoids holding the fully resolved blob in RAM, including for delta-resolved packed blobs, while still fitting the existing pack decoding model.

The repository-facing API is intentionally blob-only for now, which keeps the surface area aligned with the use case described in this issue.

Tests

Added coverage for:

  • loose blob streaming
  • packed blob streaming
  • empty blob streaming
  • rejection of non-blob IDs

Also validated with:

  • cargo test -p gix
  • cargo test -p gix-odb
  • cargo test -p gix-pack

Notes

Co-authored-by: Claude
Co-authored-by: Codex

mjgil added 6 commits April 19, 2026 21:16
Add streaming blob lookup support for loose and packed objects, avoid eagerly materializing packed results into memory, and expose repository helpers with regression coverage for loose, packed, empty, and wrong-type cases.

Co-authored-by: Claude

Co-authored-by: Codex
Reject truncated loose-object streams, restore delta output-length validation, and add allocator-backed proof that packed delta blob streaming lowers peak memory usage compared to eager blob lookup.

Co-authored-by: Codex
Bring the gix_object::Write trait into scope for write_buf() and remove the unused Read import so workspace clippy and test builds pass again.

Co-authored-by: Codex
Accept both UnexpectedEof and InvalidData for truncated loose-object stream corruption, as the stream reader can surface either depending on where zlib detects the truncated deflate payload.

Co-authored-by: Codex
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