| 57 | } |
| 58 | |
| 59 | int cache_tree_subtree_pos(struct cache_tree *it, const char *path, int pathlen) |
| 60 | { |
| 61 | struct cache_tree_sub **down = it->down; |
| 62 | int lo, hi; |
| 63 | lo = 0; |
| 64 | hi = it->subtree_nr; |
| 65 | while (lo < hi) { |
| 66 | int mi = lo + (hi - lo) / 2; |
| 67 | struct cache_tree_sub *mdl = down[mi]; |
| 68 | int cmp = subtree_name_cmp(path, pathlen, |
| 69 | mdl->name, mdl->namelen); |
| 70 | if (!cmp) |
| 71 | return mi; |
| 72 | if (cmp < 0) |
| 73 | hi = mi; |
| 74 | else |
| 75 | lo = mi + 1; |
| 76 | } |
| 77 | return -lo-1; |
| 78 | } |
| 79 | |
| 80 | static struct cache_tree_sub *find_subtree(struct cache_tree *it, |
| 81 | const char *path, |
no test coverage detected