fetchTip
Fetch a remote's head ahead of its history: the code its names name now, and its history entry, kept before the
entries before it (Store.putTip), which arrive later (#dd5i2jqe). Returns definitions received.
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import { fetchNamespaces } from "#codebase/tcmts/cli/sync"; import type { Remote } from "#codebase/tcmts/cli/sync"; export async function fetchTip( cb: Codebase, remote: Remote, head: string, o: { say?: (line: string) => void } = {}, ): Promise<number> { const [tip] = await remote.getCausals([head]); if (!tip || tip.hash !== head) throw new Error(`${remote.label} is missing part of its history`); const stored = await fetchNamespaces(cb, remote, [tip.namespace], { checked: true, say: o.say }); cb.store.putTip(tip); return stored; }