Repository navigation
fix(fetch): clone repos whose history was rewritten by a force push - #92
Merged
Merged
Conversation
…sh (#86) Extracts the bundle-convergence loop from handle_fetch into converge_fetch behind a BundleInstaller trait (behaviour unchanged) so it can be tested without a gateway. The new force-push test fails on this commit. [AI-assisted - Claude]
…d bundle (#86) After a history-rewriting force push the needed parent lives inside an older bundle whose tip is an abandoned commit, so no bundle tip matched and a fresh clone bailed. When no unresolved parent is the tip of an undownloaded bundle, download the remaining bundles and re-walk; bail only when every bundle in the object_index is downloaded and commits are still missing. The decision is a pure function (plan_unresolved_downloads). Snapshot repos never reach the fallback. [AI-assisted - Claude]
…fetch tests (#86) The remaining-bundles fallback now installs a single bundle and re-walks, stopping as soon as the missing parent appears. Tests run under a timeout and cover several abandoned bundles, a seeded legacy bundle, two successive force pushes, and an annotated-tag want. [AI-assisted - Claude]
Finding every missing commit does not mean every blob is present: a force-push pack can omit objects reused from the abandoned history, and those may live in a bundle no missing commit points at. Revert to installing all remaining bundles and add a regression test. [AI-assisted - Claude]
[AI-assisted - Claude]
sanity
force-pushed
the
fix/86-force-push-clone
branch
from
November 26, 2026 04:10
aedd2ab to
e613fed
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After a
git push --forcethat rewrites history, every freshgit cloneof the repo fails withfetch could not converge: ... no bundle in object_index advertises them(#86). Existing clones keep working. This was reproduced 3 times on the live network with 0.1.27.The fetch finds the next bundle by looking for one whose tip is the missing parent commit. After a force push, the new bundle holds only the new commits. Their parent lives inside an older bundle whose tip is the abandoned commit, so no tip matches and the fetch gives up even though every object is in
object_index. The same shape also affected a single-branch fetch of a branch that forked from a mid-history commit.Approach
Client-side only. No contract, WASM, wire-format or dependency change.
handle_fetchintoconverge_fetch, which takes aBundleInstallerso it can be tested without a gateway. The decision step is a pure function,plan_unresolved_downloads.Repos already in this state become clonable again once this is released. No republish is needed.
Testing
The reproduction test went in first (
9286ce7). It failed with "fetch could not converge" on the old code and passes now. All tests use real git repos and packs:converge_fetch_recovers_parent_buried_in_untipped_bundle_after_force_pushconverge_fetch_fallback_fetches_blob_reused_from_abandoned_bundle: fails on the one-at-a-time variant.converge_fetch_two_successive_force_pushes_span_two_untipped_bundlesconverge_fetch_fallback_installs_every_remaining_bundleconverge_fetch_fallback_does_not_reinstall_seeded_legacy_bundleconverge_fetch_converges_when_wanted_is_an_annotated_tag_of_the_new_tipconverge_fetch_skips_dead_weight_bundle_when_history_is_complete: pins that healthy repos skip dead weight.converge_fetch_errors_when_parent_is_in_no_bundleconverge_fetch_downloads_everything_then_errors_when_parent_still_missingplan_unresolved_downloads_decisionsAll
converge_fetchtest calls run under a timeout, so a termination regression fails rather than hangs. fmt, clippy (CI flags) andcargo test -p freenet-gitare clean.Review: Codex (two passes), a skeptical lens and a testing lens. Codex's second pass found the reused-blob gap in a one-at-a-time variant, and it is fixed here. No other blocking findings. A related, pre-existing edge case with annotated tags is filed as #90.
Closes #86
[AI-assisted - Claude]