fix: prevent snapshot from tracking large files#12185
Open
goniz wants to merge 6 commits intoanomalyco:devfrom
Open
fix: prevent snapshot from tracking large files#12185goniz wants to merge 6 commits intoanomalyco:devfrom
goniz wants to merge 6 commits intoanomalyco:devfrom
Conversation
Contributor
4860a9d to
e0be303
Compare
ced95ea to
99061cc
Compare
1d7ced8 to
369173d
Compare
goniz
commented
Feb 11, 2026
3f7b472 to
026c6ee
Compare
e6cebb3 to
72f72fb
Compare
72f72fb to
5bbccec
Compare
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.
This PR prevents the
Snapshot.track()flow from adding (untracked) big files into the snapshot system (git).It changes the code to first do
git add -N .which stage the files without content.Next it iterates over the staged files to find any files larger then defined threshold (1 gig). unstages them AND adds them to $gitdir/info/exclude to prevent them from getting staged again.
Finally it calls
git add -- $stagedFilesto stage the files content as well.To handle existing bloated snapshot dirs, the cleanup method was updated to detect if any existing object blob is bigger then threshold -> nukes the whole snapshot dir.
Leaving the big files causes the
git gc --pruneprocess to blow up on memory and hog the system.Additionally, this PR cleans up the Snapshot code a bit.
Don't be scared from the lines added, I've added tests too 😆
Fixes #6845