(p: string)
| 305 | } |
| 306 | |
| 307 | function normalizeAbsolute(p: string): string { |
| 308 | // Collapse a trailing slash (except the root) so the parent |
| 309 | // walk doesn't stall on `/foo/`. |
| 310 | let out = p.startsWith("/") ? p : `/${p}`; |
| 311 | while (out.length > 1 && out.endsWith("/")) out = out.slice(0, -1); |
| 312 | return out; |
| 313 | } |
| 314 | |
| 315 | // --------------------------------------------------------------- |
| 316 | // current-branch |