feat(sync): wire git-bundle mode so peer rehydrate keeps working git history - #481
Merged
Conversation
Branch on git_sync_mode="bundle" in collect_files: capture each enrolled repo's .git as a single `git bundle --all` (.git-tcfs-bundle) synced as a normal object, while collect_files_inner skips the raw .git/* internals. On rehydrate, restore_git_bundles_under reconstructs .git in place via git init + mirror-fetch + HEAD restore, so `git log` / `git status` / `git fetch` work on the peer without clobbering already-synced files. Park HEAD on a throwaway unborn branch before the mirror fetch: a fresh `git init` leaves HEAD on refs/heads/main and git refuses `+refs/*:refs/*` into the checked-out branch, which previously made restore a no-op. Adds git_bundle_roundtrip integration test proving a 2-commit repo round-trips with full history and a clean working tree on the peer.
Wire the bundle-restore path into cmd_pull_with_operator so a pulled .git-tcfs-bundle reconstructs the repo's .git in place (off-runtime via spawn_blocking). Completes the dev-env-parity loop: a peer that rehydrates a bundle-synced repo gets working git history, not a hollow .git. The bundle artifact is left in place (it is a synced object; local deletion would propagate to peers).
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.
What
Makes TCFS preserve working git history when a repo is rehydrated on a peer host, closing the structural dev-env parity gap where a rehydrated repo had working-tree files but no usable
.githistory.This wires the previously dead
git_safety.rsbundle path behind the existinggit_sync_mode = "bundle"policy:collect_filescaptures each safe enrolled repo's.gitas a single.git-tcfs-bundleobject viagit bundle create --all, and bundle mode skips raw.git/*internals..git-tcfs-bundleand restores.gitmetadata in place usingrestore_git_bundle_into, so the peer gets real branches, tags, objects, and HEAD.Recovery bug fixed
A fresh
git initleaves HEAD on a checked-out branch, and git refuses+refs/*:refs/*into that current branch. The restore path now parks HEAD on a temporary unborn branch before mirror-fetching bundle refs, then restores HEAD to the bundle's default branch.Validation
cargo build -p tcfs-clipassed during local validation.crates/tcfs-sync/tests/git_bundle_roundtrip.rspasses: bundle object synced, raw.git/*excluded, peer pulls objects,.gitrestored, both commits visible ingit log,git statusclean except the synced bundle artifact, HEAD onmain.Follow-ups intentionally deferred
.git-tcfs-bundleremains as a synced artifact after restore. Deleting it locally would currently propagate deletion to peers, so cleanup/gitignore policy should be a separate decision.git bundle create --allcan be expensive for very large repos; add change-detection before using bundle mode on stress targets likelinux-xr.