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

Function local_rel_path

src/discover/discover.c:541–550  ·  view source on GitHub ↗

Compute path relative to a nested .gitignore's directory. * "webapp/src/foo.js" with prefix "webapp" → "src/foo.js". */

Source from the content-addressed store, hash-verified

539/* Compute path relative to a nested .gitignore's directory.
540 * "webapp/src/foo.js" with prefix "webapp" → "src/foo.js". */
541static const char *local_rel_path(const char *rel_path, const char *local_prefix) {
542 if (!local_prefix || local_prefix[0] == '\0') {
543 return rel_path;
544 }
545 size_t prefix_len = strlen(local_prefix);
546 if (strncmp(rel_path, local_prefix, prefix_len) == 0 && rel_path[prefix_len] == '/') {
547 return rel_path + prefix_len + SKIP_ONE;
548 }
549 return rel_path;
550}
551
552/* Non-negatable safety core: built-in skip dirs that a .cbmignore negation
553 * can NEVER un-skip. A repo-committed .cbmignore must not be able to defeat

Callers 2

should_skip_directoryFunction · 0.85
file_skip_reasonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected