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

Function local_rel_path

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

652/* Compute path relative to a nested .gitignore's directory.
653 * "webapp/src/foo.js" with prefix "webapp" → "src/foo.js". */
654static const char *local_rel_path(const char *rel_path, const char *local_prefix) {
655 if (!local_prefix || local_prefix[0] == '\0') {
656 return rel_path;
657 }
658 size_t prefix_len = strlen(local_prefix);
659 if (strncmp(rel_path, local_prefix, prefix_len) == 0 && rel_path[prefix_len] == '/') {
660 return rel_path + prefix_len + SKIP_ONE;
661 }
662 return rel_path;
663}
664
665/* One .gitignore on the path from the repository root down to a walk frame.
666 * Links form a root->leaf chain; every frame below the directory that owns a

Callers 1

gitignore_chain_resultFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected