Skip to content

fix(config): Enable lfs cleanup #37671#37673

Draft
pandareen wants to merge 1 commit into
go-gitea:mainfrom
pandareen:fix-37671
Draft

fix(config): Enable lfs cleanup #37671#37673
pandareen wants to merge 1 commit into
go-gitea:mainfrom
pandareen:fix-37671

Conversation

@pandareen
Copy link
Copy Markdown
Contributor

@pandareen pandareen commented May 12, 2026

Summary

The gc_lfs cron task is only registered when LFS is enabled, but it defaulted to Enabled: false, so LFS orphan cleanup never ran unless an admin enabled it. NumberToCheckPerRepo and ProportionToCheckPerRepo were defined on GCLFSConfig but were not passed into GarbageCollectLFSMetaObjectsOptions, so the intended per-repo sampling limits had no effect.

Changes

  • Set gc_lfs BaseConfig.Enabled to true so scheduled LFS meta-object GC runs by default when the LFS server is on.
  • Forward NumberToCheckPerRepo and ProportionToCheckPerRepo from the cron config into repository.GarbageCollectLFSMetaObjects.

Notes

  • git gc still does not remove LFS blobs; gc_lfs remains the mechanism that removes orphaned lfs_meta_object rows and storage entries after pointer blobs are gone from git.
  • This fixes cron defaults and config wiring only; it does not implement full reachability-based LFS cleanup.

Fixes: #37671


Using AI Opus 4.7

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 12, 2026
@pandareen pandareen changed the title fix 37671: config fix and enable lfs cleanup fix(config): Enable lfs cleanup #37671 May 12, 2026
@wxiaoguang
Copy link
Copy Markdown
Contributor

This one should be fixed first:

-> gitea doctor check --all --fix deleted all my LFS files and attachments #36227

@wxiaoguang wxiaoguang marked this pull request as draft May 12, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LFS files are not automatically deleted after their references are removed.

3 participants