• Show log

    Commit

  • Hash : 9ac79ecc
    Author : Patrick Steinhardt
    Date : 2017-10-13T13:15:13

    blob: implement function to parse raw data
    
    Currently, parsing objects is strictly tied to having an ODB object
    available. This makes it hard to parse an object when all that is
    available is its raw object and size. Furthermore, hacking around that
    limitation by directly creating an ODB structure either on stack or on
    heap does not really work that well due to ODB objects being reference
    counted and then automatically free'd when reaching a reference count of
    zero.
    
    In some occasions parsing raw objects without touching the ODB
    is actually recuired, though. One use case is for example object
    verification, where we want to assure that an object is valid before
    inserting it into the ODB or writing it into the git repository.
    
    Asa first step towards that, introduce a distinction between raw and ODB
    objects for blobs. Creation of ODB objects stays the same by simply
    using `git_blob__parse`, but a new function `git_blob__parse_raw` has
    been added that creates a blob from a pair of data and size. By setting
    a new flag inside of the blob, we can now distinguish whether it is a
    raw or ODB object now and treat it accordingly in several places.
    
    Note that the blob data passed in is not being copied. Because of that,
    callers need to make sure to keep it alive during the blob's life time.
    This is being used to avoid unnecessarily increasing the memory
    footprint when parsing largish blobs.