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

Function local_rel_path

src/discover/discover.c:465–474  ·  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

463/* Compute path relative to a nested .gitignore's directory.
464 * "webapp/src/foo.js" with prefix "webapp""src/foo.js". */
465static const char *local_rel_path(const char *rel_path, const char *local_prefix) {
466 if (!local_prefix || local_prefix[0] == '\0') {
467 return rel_path;
468 }
469 size_t prefix_len = strlen(local_prefix);
470 if (strncmp(rel_path, local_prefix, prefix_len) == 0 && rel_path[prefix_len] == '/') {
471 return rel_path + prefix_len + SKIP_ONE;
472 }
473 return rel_path;
474}
475
476/* Non-negatable safety core: built-in skip dirs that a .cbmignore negation
477 * can NEVER un-skip. A repo-committed .cbmignore must not be able to defeat

Callers 2

should_skip_directoryFunction · 0.85
should_skip_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected