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

Function tracked_load

src/discover/discover.c:1459–1485  ·  view source on GitHub ↗

Load what git tracks under repo_path; leaves `tracked` empty on any failure, * so the ignore rules then apply exactly as they did without it. */

Source from the content-addressed store, hash-verified

1457/* Load what git tracks under repo_path; leaves `tracked` empty on any failure,
1458 * so the ignore rules then apply exactly as they did without it. */
1459static void tracked_load(discover_tracked_t *tracked, const char *repo_path) {
1460 memset(tracked, 0, sizeof(*tracked));
1461 size_t length = 0;
1462 tracked->paths = tracked_read(repo_path, &length);
1463 if (!tracked->paths || length == 0) {
1464 tracked_free(tracked);
1465 return;
1466 }
1467 tracked->files = cbm_ht_create(CBM_SZ_1K);
1468 tracked->dirs = cbm_ht_create(CBM_SZ_256);
1469 if (!tracked->files || !tracked->dirs) {
1470 tracked_free(tracked);
1471 return;
1472 }
1473 for (size_t at = 0; at < length;) {
1474 const char *path = tracked->paths + at;
1475 size_t n = strlen(path);
1476 if (n > 0) {
1477 cbm_ht_set(tracked->files, path, (void *)path);
1478 if (!tracked_add_dirs(tracked->dirs, path)) {
1479 tracked_free(tracked);
1480 return;
1481 }
1482 }
1483 at += n + SKIP_ONE;
1484 }
1485}
1486
1487/* Resolve the shared "common" git directory for repo_path.
1488 * Handles three layouts:

Callers 1

discover_implFunction · 0.85

Calls 5

tracked_readFunction · 0.85
tracked_freeFunction · 0.85
cbm_ht_createFunction · 0.85
cbm_ht_setFunction · 0.85
tracked_add_dirsFunction · 0.85

Tested by

no test coverage detected