| 1828 | } |
| 1829 | |
| 1830 | static bool gfb_matches(gfb_fixture_t *f, cbm_git_revision_t rev, const size_t *indices, |
| 1831 | size_t count, const cbm_git_blob_batch_t *out) { |
| 1832 | const char *commit = rev == CBM_GIT_REV_HEAD ? f->git.head : f->git.q; |
| 1833 | if (out->revision != rev || !out->commit || strcmp(out->commit,commit) || |
| 1834 | out->count != count || (count ? !out->items : out->items != NULL)) return false; |
| 1835 | for (size_t i=0;i<count;i++) { |
| 1836 | size_t index=indices[i]; |
| 1837 | if (index>=GFB_COUNT || index==GFB_LINK || index==GFB_SUBMODULE) return false; |
| 1838 | const cbm_git_blob_batch_item_t *item=&out->items[i]; |
| 1839 | const cbm_git_tree_entry_t *e=item->entry; |
| 1840 | const gfi_expected_t *want=&f->expected[index]; |
| 1841 | const char *oid=index==GFB_TEXT && rev==CBM_GIT_REV_MERGE_BASE ? f->git.old_text : want->oid; |
| 1842 | cbm_git_bytes_t bytes=gfb_expected_bytes(f,rev,index); |
| 1843 | if (item->inventory_index!=index || !e || !e->path || |
| 1844 | e->path_length!=want->length || memcmp(e->path,want->path,want->length) || |
| 1845 | e->path[e->path_length]!=0 || e->mode!=want->mode || e->object_type!=CBM_GIT_TREE_BLOB || |
| 1846 | strcmp(e->oid,oid) || !gf_bytes_equal(item->bytes,bytes.data,bytes.length)) return false; |
| 1847 | } |
| 1848 | return true; |
| 1849 | } |
| 1850 | |
| 1851 | /* A failed Git facts call names its stage and error: these fixtures fail |
| 1852 | * intermittently on macos-15-intel CI only, and a bare ASSERT left nothing to |
no test coverage detected