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