Skip to content

Add experimental delta calculation and custom topology support#2561

Open
HairlessVillager wants to merge 12 commits into
GitoxideLabs:mainfrom
HairlessVillager:feat/delta-2
Open

Add experimental delta calculation and custom topology support#2561
HairlessVillager wants to merge 12 commits into
GitoxideLabs:mainfrom
HairlessVillager:feat/delta-2

Conversation

@HairlessVillager
Copy link
Copy Markdown

@HairlessVillager HairlessVillager commented Apr 30, 2026

This PR introduces experimental delta calculation and custom delta relationship topology, exposed via the gix free pack delta-create CLI for verification.

As an experimental feature, I have aimed to reuse existing code as much as possible while maintaining patch cohesion. Some code has been copied from other modules or crates (marked with NOTE in comments); however, these duplications can be easily resolved by adjusting function visibility or through simple refactoring.

I'm not quite sure how to write test, and I think current test is not very graceful. Any feedback is welcome :)

Roadmap:

  • Declare experimental-delta-create feature in gitoxide-core/Cargo.toml
  • Implement core logic in gitoxide-core/src/pack/delta_create.rs
  • Add clap command-line arguments in src/plumbing/options/free.rs
  • Add gix free pack delta-create CLI in src/plumbing/main.rs
  • Add journey tests in tests/journey/gix.sh

Closes #2531

HairlessVillager and others added 6 commits April 30, 2026 21:30
`from_delta_ref` now accepts pre-compressed data and a separate
`decompressed_size`, removing the redundant zlib round-trip.

- `find_delta` returns `(&[u8], u64)` borrowing compressed bytes
  directly from the pack entry
- "new delta" path compresses `diff()` output once via deflate::Write
- `compute_delta` renamed to `diff`, encodes varint header + instructions
  into a single buffer
- Feature gate `experimental-delta-create` now includes `dep:parking_lot`

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Covers three code paths: new delta (compute_delta), new base
(from_data), and reuse delta (find_delta). Uses a dedicated
`kind="delta-create"` to avoid modifying existing journey tests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The `from_delta_ref` function was a one-liner wrapper around
`output::Entry` construction — too trivial to warrant its own
function and `mod entry` block.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@HairlessVillager HairlessVillager marked this pull request as ready for review May 1, 2026 02:05
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 937d69cbd1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".

Comment thread gitoxide-core/src/pack/delta_create.rs Outdated
Comment thread gitoxide-core/src/pack/delta_create.rs
HairlessVillager and others added 4 commits May 1, 2026 10:27
The `count::objects()` API requires `Box<dyn Iterator + Send>` which
implicitly has a `'static` lifetime bound. The previous implementation
used `.inspect()` to populate the `topo` HashMap lazily within the
iterator chain, allowing input parsing and counting to overlap. Boxing
this iterator as `'static` conflicts with `topo`'s non-static borrow.

As a workaround, eagerly collect all parsed input into a Vec first,
populate `topo` in a separate pass, then create the boxed iterator from
the collected data. This trades the lazy streaming for an extra
allocation.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

Customizing Delta Topological Relationships for Pack Files

1 participant