def root.rel

ezx@1.11.0.0 · src/git/git.bend:237

import ezx@1.11.0.0/src/git/git.bend as Git
import Base
import ezx@1.11.0.0/src/pkg/path.bend as P

237# the directory inside the repo a package's paths are written from. `pkg/pkg`
238# resolves that against the checkout it read; the lock records it against the
239# repo, so the same number of components is climbed back off the entry's own
240# directory here. It is "." until a module reached through `..` re-roots the
241# package above the entry.
242def root.rel(+at: String, root: String, +entry: String) -> String:
243  P.climb(Nat.sub(depth(P.dir(at)), depth(root)), P.dir(entry))

Uses (5)

Used by (1)