| 20 | } |
| 21 | |
| 22 | bool tpt_batch(tpt_context *c, const cbm_pinned_tree_options_t *o, cbm_git_blob_batch_t *out) { |
| 23 | cbm_pinned_tree_t *t = c->tree; |
| 24 | cbm_git_blob_batch_request_t request = {o->revision, t->indices, t->view.file_count}; |
| 25 | if (!tpt_poll(c)) |
| 26 | return false; |
| 27 | cbm_git_facts_error_t error = {0}; |
| 28 | bool ok = cbm_git_facts_read_blob_batch(o->facts, &request, &o->limits.blob_batch, out, &error); |
| 29 | if (!tpt_after_facts(c, ok, &error)) |
| 30 | return false; |
| 31 | if (out->revision != o->revision || out->count != t->view.file_count || |
| 32 | (out->count && !out->items) || (!out->count && out->items) || |
| 33 | out->count > SIZE_MAX / sizeof(*out->items) || |
| 34 | !tpt_oid(c, out->commit, t->identity.oid_hex_length) || |
| 35 | !tpt_equal(c, out->commit, t->view.commit, t->identity.oid_hex_length + 1)) |
| 36 | return tpt_fail(c, CBM_PINNED_TREE_GIT, "batch revision correspondence"); |
| 37 | for (size_t i = 0; i < out->count; i++) { |
| 38 | if (!tpt_poll(c) || !tpt_batch_row(c, &out->items[i], i)) |
| 39 | return false; |
| 40 | } |
| 41 | return true; |
| 42 | } |
no test coverage detected