Repository navigation
Git lfs e2e - #1012
Git lfs e2e#1012rdartus wants to merge 6 commits into
Conversation
Sync To Upstream
With --git-lfs, enable the git-lfs filters in git-sync's private gitconfig (git lfs install --skip-repo), so LFS-tracked files are downloaded when git checks them out (including in submodules) instead of being left as pointers. git-sync fails at startup if git-lfs is not installed, and a sync fails if an LFS object can't be fetched. Note: just running 'git lfs pull' is not enough, since it skips replacing pointer files unless the filters are already configured.
- Dockerfile.in: install git-lfs. - _test_tools/lfs-server: lfs-test-server (public mode) in a scratch image. The binary is built by make test-tools from the version pinned in tools/go.mod, not downloaded at image-build time. - test_e2e.sh: tests for LFS disabled, enabled, --depth, updates and a missing object. No git server is needed: objects are uploaded with git lfs push.
git_lfs_updates failed on slower runners: the test committed first and uploaded the LFS object afterwards, so a git-sync polling every 100ms could fetch the new commit before the object existed on the server, and the checkout failed with a 404 (and git-sync exits on the first failure). Stage the file, push its object by ID, and only then commit.
The flag was only described in the README, and its text still described a 'git lfs pull' approach. Add it to the manual that --man prints (the manual in main.go and the README carry the same text), place it with the other --git-* flags, and describe the actual behavior.
|
Welcome @rdartus! |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rdartus The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
/kind feature
What does this PR do?
Implement git lfs so that git sync is compatible with repo using git-lfs (in v4):
--git-lfs(env : GITSYNC_GIT_LFS), false by default._test_tools/lfs-server/-p git-lfsso that lfs is usableWhy
This feature was requested as far as in git-sync v3 and never really finished du to the contributor lack of time. (#174 / #654 / #699)
Limits
Known limits (and what I couldn't decide alone) :
$ROOT/.git/lfs- it should be pruned (git lfs prune) so that it doesn't accumulate...Testing
go vet, gofmt : OK.

Tests were done with test_git.sh, with the lfs server added in test_e2e.sh
Also tested with github action (build, test, publish)
Finally with this image I checked with my personal cluster if this image worked (logs attached) - with my use case
logs.txt
Notes for reviewers
I wrote theses changes and commit with AI (ashamed to say that it did a better job than my last try to add lfs 2 years ago...)
I garantee that, what I wrote in this comment is 100% human and you will converse with a human.