| 64 | } |
| 65 | |
| 66 | static bool tpt_load(tpt_context *c, const cbm_pinned_tree_options_t *o) { |
| 67 | if (!tpt_identity_copy(c, o) || !tpt_poll(c)) |
| 68 | return false; |
| 69 | cbm_git_tree_inventory_t inventory = {0}; |
| 70 | cbm_git_tree_inventory_t regular = {0}; |
| 71 | size_t *original = NULL; |
| 72 | cbm_git_facts_error_t error = {0}; |
| 73 | bool ok = cbm_git_facts_inventory(o->facts, o->revision, &inventory, &error); |
| 74 | if (!tpt_after_facts(c, ok, &error) || !tpt_without_links(c, &inventory, ®ular, &original) || |
| 75 | !tpt_plan(c, o, ®ular)) |
| 76 | return false; |
| 77 | /* The plan numbered the kept entries; the blob batch names positions in |
| 78 | * the facts' own inventory. */ |
| 79 | for (size_t i = 0; original && i < c->tree->view.file_count; i++) |
| 80 | c->tree->indices[i] = original[c->tree->indices[i]]; |
| 81 | cbm_git_blob_batch_t batch = {0}; |
| 82 | return tpt_batch(c, o, &batch) && tpt_native_prepare(c) && tpt_build(c, &batch) && |
| 83 | tpt_audit(c) && tpt_manifest(c) && tpt_poll(c); |
| 84 | } |
| 85 | |
| 86 | static void tpt_cleanup_error(tpt_context *c, const cbm_pinned_tree_error_t *primary) { |
| 87 | cbm_pinned_tree_error_t cleanup = c->error; |
no test coverage detected