diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2016-04-22 18:12:09 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2016-04-22 18:12:09 +0200 |
commit | 5fe874632df9c70022e2ea47a01876780f8b3d02 (patch) | |
tree | 5ae8cb5782df1b75e7cd6ec89c1df2cbb984f01f /src/odb.c | |
parent | 1dc449105b329ea4f8ea9982bc2da869d231c04a (diff) | |
download | libgit2-cmn/read-only-size.tar.gz |
odb: allow asking for the size alonecmn/read-only-size
Reading a packed object's type can be expensive if it's deeply
chained. Allow a caller to skip that part of the lookup if they don't
care or know the type through other means.
Diffstat (limited to 'src/odb.c')
-rw-r--r-- | src/odb.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -900,11 +900,12 @@ int git_odb__read_header_or_object( int error = GIT_ENOTFOUND; git_odb_object *object; - assert(db && id && out && len_p && type_p); + assert(db && id && out && len_p); if ((object = git_cache_get_raw(odb_cache(db), id)) != NULL) { *len_p = object->cached.size; - *type_p = object->cached.type; + if (type_p) + *type_p = object->cached.type; *out = object; return 0; } |