Repository navigation
feat: replicate canonical Git LFS pointers before publishing refs - #36
Merged
Merged
Conversation
Address review findings on the canonical LFS transfer: - pushRefs now publishes through the isolated lfsRun environment (pinned endpoints, side token, cache lock), so inherited config cannot redirect it. - pointHEADAbsent uses refs/gh-replicate/ (outside fetched namespaces) and verifies HEAD does not resolve, so a committed .lfsconfig is never read. - cancellation kills the whole process group on Unix, not just the direct git, so a git-lfs descendant cannot outlive the ephemeral bare. - lfsSideEnv preserves lowercase proxy variables as well as uppercase. - ci.yml filter references the renamed TestSyncGitLifecycle.
- Block LFS transfer on platforms without whole-tree cancellation (Windows). - Fail closed when the ephemeral HEAD unexpectedly resolves. - Prove per-side credential separation (unit test + external proxy/CA ensayo). - Assert dry-run makes no LFS requests and an upload failure stops before Actions or any ref push. - Build-tag the process-tree test to unix. - Document best-effort cleanup and possible orphaned upload objects.
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
When
refsis selected and the source contains Git LFS pointers, gh-replicate now downloads the LFS objects, verifies them and uploads them to the destination before publishing any ref, instead of stopping. The run still stops safely on anything it cannot transfer.Why
Fixes the core of #5: a repository with Git LFS used to be rejected entirely (fail-fast) because pushing pointers without their objects would leave the destination broken. This delivers LFS support for the common case while keeping that barrier for everything else.
How
syncGitnow runs in a fresh, private, ephemeral bare repository with isolated configuration, instead of the shared incremental cache. Credentials and endpoints are pinned per side (lfs.url/lfs.pushurl), and the cache lock still serialises runs of the same source.version https://git-lfs.github.com/spec/v1, exactly three LF lines, no extensions, smaller than 1024 bytes — are transferred.git lfs fetch --all --stdindownloads the objects, each is checked for existence, size and SHA-256, thengit lfs push --all --stdinuploads them, before Actions are disabled and refs are pushed atomically.git-lfs3.8.1 or newer is required only when LFS is confirmed; repositories without LFS need no change..lfsconfigis never read.How tested
go test -race -count=1 -timeout 3m ./...— 165 tests.go test -race -tags=lfsintegration ./...— adds a realgit-lfs3.8.1 transfer against a synthetic HTTP LFS batch server (download from the source, verify, upload to the destination).go vet ./...,gofmt -l .,git diff --check— clean.Remaining work
hawser,git-media), CRLF, padding, extensions and unrecognised versions still stop the run. Supporting those is follow-up, so this does not close Replicate Git LFS objects before updating destination refs #5.lfs.urlpinning andgh auth git-credentialhelper the existing git fetch uses.