| 785 | /* ── Existence check ─────────────────────────────────────────────── */ |
| 786 | |
| 787 | bool cbm_artifact_exists(const char *repo_path) { |
| 788 | if (!repo_path) { |
| 789 | return false; |
| 790 | } |
| 791 | |
| 792 | char zst_path[CBM_SZ_4K]; |
| 793 | artifact_path(zst_path, sizeof(zst_path), repo_path, CBM_ARTIFACT_FILENAME); |
| 794 | |
| 795 | struct stat st; |
| 796 | if (stat(zst_path, &st) != 0 || st.st_size == 0) { |
| 797 | return false; |
| 798 | } |
| 799 | |
| 800 | /* Check schema version is compatible */ |
| 801 | int version = read_metadata_version(repo_path); |
| 802 | return version >= 0 && version <= CBM_ARTIFACT_SCHEMA_VERSION; |
| 803 | } |
| 804 | |
| 805 | /* ── Commit hash extraction ──────────────────────────────────────── */ |
| 806 |
no test coverage detected