diff options
author | Patrick Steinhardt <ps@pks.im> | 2017-10-13 13:15:13 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2018-06-22 09:50:07 +0200 |
commit | 9ac79ecce24a2c65e91ee0c2b414fd606b26309f (patch) | |
tree | 100434f61710ea0cd00d357ad9bdbe0a859828ea /src/commit.c | |
parent | bbbe8441750a9072a6f4e96c8d364ede79dd2300 (diff) | |
download | libgit2-9ac79ecce24a2c65e91ee0c2b414fd606b26309f.tar.gz |
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.
Diffstat (limited to 'src/commit.c')
0 files changed, 0 insertions, 0 deletions