libgit2/libgit2 — pull request #2345 by arrbee (2014-05-12 21:42:26+00:00)
Title: Add lax parsing for commit and tag objects

This is a proposal for dealing with the fact that Git (and other Git implementations) sometimes create objects in the ODB that fail to pass libgit2's parsing rules. This is designed to give a way to get the `git_object` as best as possible, even if it appears to be non-compliant.

This changes the behavior of object parsing for commits and tags so that even when bad data is found inside the object, we will continue to try to parse as much of the object as we can. The existing functions (`git_object_lookup` for example) still delete the partially parsed object before returning an error, but this also adds a new function `git_object_lookup_lax` that will still return the error code, but will also return the object with the partial data (if we got far enough along in the parsing process to even create the base object).

I'm not sure if this is the right solution, and certainly the implementation is way more intrusive than it has to be, but I've been playing around with this code for a few days (mostly off and on) and I thought I should get some feedback before spending more time on it.