| 2005 | } |
| 2006 | |
| 2007 | static bool gf_batch_publish(gf_batch_work_t *work, cbm_git_blob_batch_t *out, |
| 2008 | cbm_git_facts_error_t *error) { |
| 2009 | size_t count = work->request->count; |
| 2010 | cbm_git_blob_batch_item_t *items = NULL; |
| 2011 | if (count) { |
| 2012 | items = gf_batch_array(work->facts, count, sizeof(*items), error); |
| 2013 | if (!items) |
| 2014 | return false; |
| 2015 | for (size_t i = 0; i < count; i++) { |
| 2016 | if (!gf_gate(work->facts, error)) |
| 2017 | return false; |
| 2018 | const gf_batch_pick_t *pick = &work->picks[i]; |
| 2019 | items[pick->position] = |
| 2020 | (cbm_git_blob_batch_item_t){.inventory_index = pick->inventory_index, |
| 2021 | .entry = pick->entry, |
| 2022 | .bytes = work->objects[pick->object_index].bytes}; |
| 2023 | } |
| 2024 | } |
| 2025 | if (!gf_history_guard(work->facts, error) || !gf_gate(work->facts, error)) |
| 2026 | return false; |
| 2027 | *out = (cbm_git_blob_batch_t){.revision = work->request->revision, |
| 2028 | .commit = gf_revision(work->facts, work->request->revision), |
| 2029 | .items = items, |
| 2030 | .count = count}; |
| 2031 | return true; |
| 2032 | } |
| 2033 | |
| 2034 | static bool gf_batch_execute(cbm_git_facts_t *facts, const cbm_git_blob_batch_request_t *request, |
| 2035 | const cbm_git_blob_batch_limits_t *limits, cbm_git_blob_batch_t *out, |
no test coverage detected