Skip to content

Fix a bug where lfs gc never worked. #35198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

lunny
Copy link
Member

@lunny lunny commented Aug 1, 2025

Fix #31113

After #22385 introduced LFS GC, it never worked due to a bug in the INI library: fields in structs embedded more than one level deep are not populated from the INI file.

This PR fixes the issue by replacing the multi-level embedded struct with a single-level struct for parsing the cron.gc_lfs configuration.

Added a new test for retrieving cron settings to demonstrate the bug in the INI package.

@lunny lunny requested a review from zeripath August 1, 2025 22:37
@lunny lunny added type/bug backport/v1.24 This PR should be backported to Gitea 1.24 labels Aug 1, 2025
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 1, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Aug 1, 2025
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 1, 2025
@wxiaoguang
Copy link
Contributor

But is it right? Is the Test_getCronSettings2 related to the real code?

In the future, if a change in registerGCLFS introduces new bug, the Test_getCronSettings2 still pass and lie to developers that "oh, everything is fine"?

@lunny
Copy link
Member Author

lunny commented Aug 2, 2025

Added a new test for retrieving cron settings to demonstrate the bug in the INI package.

The test just demonstrate there is a bug in the INI package.

@wxiaoguang
Copy link
Contributor

Added a new test for retrieving cron settings to demonstrate the bug in the INI package.

The test just demonstrate there is a bug in the INI package.

Why not provide a correct test for real code?

@lunny
Copy link
Member Author

lunny commented Aug 2, 2025

Added a new test for retrieving cron settings to demonstrate the bug in the INI package.

The test just demonstrate there is a bug in the INI package.

Why not provide a correct test for real code?

17e00d6 added a test for Get GC LFS configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v1.24 This PR should be backported to Gitea 1.24 lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/go Pull requests that update Go code type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The cron job to garbage collect LFS pointers is not active
4 participants