def anchor

ezx@1.11.0.0 · src/lock/up.bend:81

import ezx@1.11.0.0/src/lock/up.bend as Up
import Base
import ezx@1.11.0.0/src/pkg/path.bend as Path

81# a question as git is to be asked it: the source it names anchored at the
82# directory `here` (`Path.anchor`), so a relative path, which the ledger keeps
83# relative to the project, is read from the project wherever git runs. A URL
84# and an absolute path are as they are, and a question that names no source
85# is as it is.
86def anchor(+here: String, ask: Ask) -> Ask:
87  match ask:
88    case Refs{url, ref}:
89      Refs{Path.anchor(here, url), ref}
90    case Head{url}:
91      Head{Path.anchor(here, url)}
92    case Tags{url}:
93      Tags{Path.anchor(here, url)}
94    case Above{url, pin, tip}:
95      Above{Path.anchor(here, url), pin, tip}
96    case Tree{url, rev, entry}:
97      Tree{Path.anchor(here, url), rev, entry}
98    case Weigh{url, rev}:
99      Weigh{Path.anchor(here, url), rev}
100    case HubHas{hub, hash}:
101      HubHas{hub, hash}
102    case Ignore{}:
103      Ignore{}
104    case Sources{}:
105      Sources{}
106    case Clone{url, rev}:
107      Clone{Path.anchor(here, url), rev}

Uses (3)

Used by (1)