diff options
author | Vicent Marti <tanoku@gmail.com> | 2016-03-09 17:47:53 +0100 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2016-03-09 18:17:37 +0100 |
commit | 1bbcb2b279b2a5b8cdf5687daf023cd67cb33ed7 (patch) | |
tree | b2885ffb423bc591355e46837d649970467085f7 /src/odb.c | |
parent | e78d2ac9398a2b23349c3b22cbdeb9f2392ffdc8 (diff) | |
download | libgit2-vmg/expand-fixes.tar.gz |
odb: Try to lookup headers in all backends before passthroughvmg/expand-fixes
Diffstat (limited to 'src/odb.c')
-rw-r--r-- | src/odb.c | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -855,8 +855,9 @@ static int odb_read_header_1( const git_oid *id, bool only_refreshed) { size_t i; - int error = GIT_PASSTHROUGH; git_otype ht; + bool passthrough = false; + int error; if (!only_refreshed && (ht = odb_hardcoded_type(id)) != GIT_OBJ_BAD) { *type_p = ht; @@ -864,18 +865,32 @@ static int odb_read_header_1( return 0; } - for (i = 0; i < db->backends.length && error < 0; ++i) { + for (i = 0; i < db->backends.length; ++i) { backend_internal *internal = git_vector_get(&db->backends, i); git_odb_backend *b = internal->backend; if (only_refreshed && !b->refresh) continue; - if (b->read_header != NULL) - error = b->read_header(len_p, type_p, b, id); + if (!b->read_header) { + passthrough = true; + continue; + } + + error = b->read_header(len_p, type_p, b, id); + + switch (error) { + case GIT_PASSTHROUGH: + passthrough = true; + break; + case GIT_ENOTFOUND: + break; + default: + return error; + } } - return error; + return passthrough ? GIT_PASSTHROUGH : GIT_ENOTFOUND; } int git_odb__read_header_or_object( |