| 1018 | } gfi_expected_t; |
| 1019 | |
| 1020 | static bool gfi_matches(const cbm_git_tree_inventory_t *inventory, |
| 1021 | const gfi_expected_t *expected, size_t count) { |
| 1022 | if (inventory->count != count || (count && !inventory->entries)) |
| 1023 | return false; |
| 1024 | if (!count) |
| 1025 | return inventory->entries == NULL; |
| 1026 | for (size_t i = 0; i < count; i++) { |
| 1027 | const cbm_git_tree_entry_t *entry = &inventory->entries[i]; |
| 1028 | size_t oid_length = strlen(expected[i].oid); |
| 1029 | if (!entry->path || entry->path_length != expected[i].length || |
| 1030 | memcmp(entry->path, expected[i].path, expected[i].length) != 0 || |
| 1031 | entry->path[entry->path_length] != '\0' || entry->mode != expected[i].mode || |
| 1032 | entry->object_type != expected[i].type || oid_length >= sizeof(entry->oid) || |
| 1033 | entry->oid[oid_length] != '\0' || memcmp(entry->oid, expected[i].oid, oid_length) != 0) |
| 1034 | return false; |
| 1035 | } |
| 1036 | return true; |
| 1037 | } |
| 1038 | |
| 1039 | static bool gfi_cleared(const cbm_git_tree_inventory_t *inventory) { |
| 1040 | return inventory->entries == NULL && inventory->count == 0; |
no outgoing calls
no test coverage detected