-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix shallow root maintenance during fetch #6846
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
Conversation
Hmm, sounds right, but it looks like you've uncovered a memory leak. 🤔 |
93071a0
to
a5f3380
Compare
a5f3380
to
9e40c13
Compare
@ethomson - Could you please have another look at this? I believe the memory leak you'd spotted was a knock-on impact of an existing test failing due to the fix. I've updated the online::shallow::shorten_four test to reflect what git does when fetching with depth 5, and then 4 afterwards. It doesn't actually remove the original set of shallow roots, presumably because they're not traversed on the server during the subsequent fetch. It's not until git gc is run the unreachable shallow roots are removed. Now that I've realized where to add a new test - I've added one to prove existing shallow roots will be preserved during fetch for an unrelated branch, and that they'll be removed as expected during subsequent fetches. Outstanding/failing test appears to be one of the flaky network tests. |
Ah, that makes sense. Perfect, thanks so much. 🙏 |
Fixes issue where the shallow roots array size wasn't being copied as part of preparing to perform a fetch.
This resulted in the shallow roots file being removed unexpectedly at the end of the fetch, even though there's still one or more shallow root commits as they weren't included/ancestors of the branches/commits fetched, which subsequently led to invalid/missing object errors.