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

Function dir_is_cache_tree

src/discover/discover.c:780–794  ·  view source on GitHub ↗

The cache directory holds every indexed project's graph database. When a custom * CBM_CACHE_DIR sits inside a repository — which happens in tests and is legal in * production — walking into it would pull other projects' databases into this * project's file list. Prune it by absolute path. * * This is the narrow remedy for a concern that was briefly implemented as * refusing any root containi

Source from the content-addressed store, hash-verified

778 * refusing any root containing the cache: refusing a whole root was too blunt,
779 * and not walking the cache is what the concern actually asks for. */
780static bool dir_is_cache_tree(const char *abs_path) {
781 const char *cache = g_walk_cache_dir;
782 if (!cache[0] || !abs_path || !abs_path[0]) {
783 return false;
784 }
785 size_t n = strlen(cache);
786 while (n > 1 && (cache[n - 1] == '/' || cache[n - 1] == '\\')) {
787 n--;
788 }
789 if (strncmp(abs_path, cache, n) != 0) {
790 return false;
791 }
792 /* Boundary-aware so "<cache>x" is not treated as living under "<cache>". */
793 return abs_path[n] == '\0' || abs_path[n] == '/' || abs_path[n] == '\\';
794}
795
796/* What the ignore rules say about a directory. DIR_GIT_IGNORED comes from
797 * git's own rules (.gitignore files, info/exclude, the global excludes file),

Callers 1

walk_dir_process_entryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected