MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / tpt_counts

Function tpt_counts

src/mcp/test_impact_tree_plan.c:99–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99static bool tpt_counts(tpt_context *c, const cbm_git_tree_inventory_t *inventory,
100 size_t *directories) {
101 const cbm_git_tree_entry_t *previous = NULL;
102 *directories = 1;
103 for (size_t i = 0; i < inventory->count; i++) {
104 if (!tpt_poll(c) || !tpt_inventory_row(c, &inventory->entries[i], previous))
105 return false;
106 previous = &inventory->entries[i];
107 }
108 previous = NULL;
109 for (size_t i = 0; i < inventory->count; i++) {
110 const cbm_git_tree_entry_t *entry = &inventory->entries[i];
111 if (!tpt_poll(c))
112 return false;
113 for (size_t j = 0; j < entry->path_length; j++) {
114 if (entry->path[j] != '/' || !tpt_prefix_new(c, entry, previous, j))
115 continue;
116 if (!tpt_file_prefix(c, inventory, entry->path, j))
117 return false;
118 if (*directories >= c->tree->limits.max_directories)
119 return tpt_fail(c, CBM_PINNED_TREE_LIMIT, "directory count limit");
120 (*directories)++;
121 }
122 previous = entry;
123 }
124 return tpt_poll(c);
125}
126
127static size_t tpt_find_directory(tpt_context *c, const char *path, size_t n, size_t used) {
128 if (!n)

Callers 1

tpt_planFunction · 0.85

Calls 5

tpt_pollFunction · 0.85
tpt_inventory_rowFunction · 0.85
tpt_prefix_newFunction · 0.85
tpt_file_prefixFunction · 0.85
tpt_failFunction · 0.85

Tested by

no test coverage detected