Repository navigation
Improve Git LFS handling when creating source archives from Git - #5335
Open
pavelToman wants to merge 8 commits into
Open
pavelToman wants to merge 8 commits into
pavelToman wants to merge 8 commits into
Conversation
Add tests for Git LFS pointer detection and handling in various scenarios.
Contributor
Author
|
Found this problem during the work on easybuilders/easybuild-easyconfigs#27145 |
Refactor Git LFS pointer handling and update deprecation warnings.
Refactor Git LFS pointer tests and improve isolation of Git configuration for testing. Update function names and add more comprehensive checks for valid and invalid LFS pointers.
Add various invalid pointer cases for testing.
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.
Summary
Improve Git LFS handling in
get_source_tarball_from_git()to ensure that Git LFS objects are downloaded when needed, without unnecessarily requiringgit-lfsfor repositories that only contain Git LFS attributes.The previous implementation relied on detecting
filter=lfsin.gitattributes, which could produce false positives. Git LFS filters could also be triggered during checkout before checking whethergit-lfswas available.This PR additionally improves source archive reproducibility, prevents silently incomplete LFS downloads, and reduces filesystem overhead when detecting LFS pointers.
Changes
git check-attrcalls.git lfs version, and only when actual LFS pointers are detected.lfs.fetchincludeandlfs.fetchexcludesettings to prevent user-level and repository-level fetch filters from affecting source archives.extra_config_paramsin the easyconfig.git-lfsis unavailable.Compatibility
Testing
Tested on the UGent donphan HPC cluster with Python 3.9.25 and Git 2.52.0.
Framework tests
test.framework.filetoolssuite: 81/82 tests pass, with the same pre-existingtest_fake_vscfailure as before these changes.Integration tests
Verified using real Git LFS objects and local repositories:
Real-world source fetching
Successfully fetched sources from scratch using the following unmodified easyconfigs and the updated framework:
LINC-5.0-foss-2023b.ebkeep_git_dir=True).dorado-2.1.2-foss-2025a-CUDA-12.8.0.ebGeneformer-0.1.0-20260526-foss-2024a-CUDA-12.6.0.ebPySONIC-1.0-20250519-foss-2023a.ebThe generated source archives were independently inspected to verify the expected LFS content.
Git LFS was not manually loaded before fetching, allowing verification of automatic module loading via
source_deps.Compatibility error handling for older Git and Git LFS versions was verified through simulated command failures.
Previous PRs
source_depseasyconfig parameter #5273git_configsources #5297git lfs pull#5317test_github_get_source_tarball_from_git: 'git lfs pull' command is not run (anymore) byget_source_tarball_from_git#5320Done with help from ChatGPT6.2 and additional review by Claude Opus 5.5.