| 1800 | } |
| 1801 | |
| 1802 | static bool gf_batch_inventory(gf_batch_work_t *work, cbm_git_facts_error_t *error) { |
| 1803 | cbm_git_facts_t *facts = work->facts; |
| 1804 | const char *commit = gf_revision(facts, work->request->revision); |
| 1805 | for (size_t i = 0; i < 2; i++) { |
| 1806 | if (facts->inventory_cache[i].commit && |
| 1807 | strcmp(facts->inventory_cache[i].commit, commit) == 0) { |
| 1808 | work->inventory = facts->inventory_cache[i].inventory; |
| 1809 | return gf_gate(facts, error); |
| 1810 | } |
| 1811 | } |
| 1812 | if (!cbm_git_facts_inventory(facts, work->request->revision, &work->inventory, error)) |
| 1813 | return false; |
| 1814 | for (size_t i = 0; i < 2; i++) { |
| 1815 | if (!facts->inventory_cache[i].commit) { |
| 1816 | facts->inventory_cache[i] = (gf_inventory_cache_t){commit, work->inventory}; |
| 1817 | return true; |
| 1818 | } |
| 1819 | } |
| 1820 | return gf_error(error, CBM_GIT_FACTS_INVALID, "Invalid internal pinned inventory cache"); |
| 1821 | } |
| 1822 | |
| 1823 | static int gf_batch_pick_compare(const gf_batch_pick_t *a, const gf_batch_pick_t *b, size_t width) { |
| 1824 | int cmp = memcmp(a->entry->oid, b->entry->oid, width); |
no test coverage detected