The tree of the project-less directory rel[0, len): the length of its root * -- the largest directory around it that has no project in or below it; the * directory itself when a project stands below it (*whole stays unset: what * is under it is not all of its tree). `memo` is what `dir_unit` holds for * the directory the walk for a project stopped at: a tree's root when that * directory is of
| 1417 | * directory is of a known tree, and then everything under it is of that tree |
| 1418 | * too. `dir` is scratch for the paths asked. */ |
| 1419 | static size_t tree_root(const cs_index_t *ix, const char *rel, size_t len, intptr_t memo, char *dir, |
| 1420 | bool *whole) { |
| 1421 | if (memo < CS_NONE) { |
| 1422 | *whole = true; |
| 1423 | return (size_t)(-(memo + PAIR_LEN)); |
| 1424 | } |
| 1425 | memcpy(dir, rel, len); |
| 1426 | dir[len] = '\0'; |
| 1427 | if (cbm_ht_get(ix->project_above, dir)) { |
| 1428 | return len; |
| 1429 | } |
| 1430 | *whole = true; |
| 1431 | size_t root = len; |
| 1432 | while (root > 0) { |
| 1433 | cs_work(SKIP_ONE); |
| 1434 | size_t up = parent_dir_len(rel, root); |
| 1435 | dir[up] = '\0'; |
| 1436 | if (cbm_ht_get(ix->project_above, dir)) { |
| 1437 | break; |
| 1438 | } |
| 1439 | root = up; |
| 1440 | } |
| 1441 | return root; |
| 1442 | } |
| 1443 | |
| 1444 | /* The unit a file belongs to: its project -- the nearest directory at or |
| 1445 | * above its own that holds a *.csproj. A file no project file stands above |
no test coverage detected