Compute path relative to a nested .gitignore's directory. * "webapp/src/foo.js" with prefix "webapp" → "src/foo.js". */
| 539 | /* Compute path relative to a nested .gitignore's directory. |
| 540 | * "webapp/src/foo.js" with prefix "webapp" → "src/foo.js". */ |
| 541 | static 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 |
no outgoing calls
no test coverage detected