This repository was archived by the owner on Sep 11, 2020. It is now read-only.
plumbing/format/packfile: Fix broken "thin" packfile support. Fixes #991 #994
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.
We have noticed that thin-pack support by the parser stopped working after upgrading from 4.5.0 to the latest version 4.7.1, but going back, it doesn't work since 4.6.0.
When the parser is given a so-called "thin" pack file, it will panic with a nil-pointer exception in
Parser.get()
as this function receives a nilo
*objectInfo
parameter. I traced this back toindexObjects()
case plumbing.REFDeltaObject
where theParent
property is left uninitialized when a REF delta object base is not found in the current pack. Unit tests did not check for thin-pack eventuality, and thus this case was uncovered.This is an attempt to fix the issue. The strategy is to initialize
objInfo.Parent
to a "placeholder" parent, so we can detect this during the resolve phase.I would need your guidance in writing tests for this one, as I am not sure how to produce a thin pack file out of the fixtures: these types of pack files only exsist on the network when git is moving stuff, never stored on disk.