plumbing/format/packfile: Fix broken "thin" packfile support. Fixes #991#994
plumbing/format/packfile: Fix broken "thin" packfile support. Fixes #991#994mcuadros merged 2 commits intosrc-d:masterfrom
Conversation
…rc-d#991 Signed-off-by: Javier Peletier <[email protected]>
e54553b to
66d82a5
Compare
|
I've managed to create a thin pack from fixtures repo labeled It's 726 bytes so it may be added to the test source. You can find the file here: https://downloads.zooloo.org/thin.pack The way it was generated was creating a new commit, getting the list of unpacked objects and passing it to |
Signed-off-by: Javier Peletier <[email protected]>
|
@jfontan I have added a test for this, please take a look. Please check it out and let me know. Thanks. |
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*objectInfoparameter. I traced this back toindexObjects()case plumbing.REFDeltaObjectwhere theParentproperty 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.Parentto 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.