import type { Dispatch, HeadRef } from './types.ts'; export declare const SYMREF_PREFIX = "ref: "; export declare const BRANCH_PREFIX = "refs/heads/"; /** * Resolve `.git/HEAD` to a branch name or a detached commit. * * HEAD holds either a symbolic ref (`ref: refs/heads/main`) or a raw object id * when the checkout is detached. A ref outside `refs/heads` keeps its full name, * which is what git shows for a checked-out tag or remote-tracking ref. */ export declare function readHead(dispatch: Dispatch, gitdir: string): Promise; /** * Point one ref at an object id, as a loose ref file. * * Always written loose, never into `packed-refs`: git does the same for any ref * it updates, and a loose file takes precedence over the packed copy, so a * branch that was packed is correctly overridden rather than duplicated. * * Refs live in the common directory, so a branch made from a linked worktree is * visible to the repository it was cut from, which is what makes `git worktree` * share branches at all. */ export declare function writeRef(dispatch: Dispatch, commondir: string, ref: string, sha: string): Promise; /** * Remove a loose ref file. * * Only the loose copy is removed. A ref that also sits in `packed-refs` would * come back, which is a real gap rather than a silent one: `branch -d` refuses * unless the loose file is what actually holds the branch. */ export declare function deleteRef(dispatch: Dispatch, commondir: string, ref: string): Promise; /** Point HEAD at a branch, symbolically. */ export declare function setHead(dispatch: Dispatch, gitdir: string, ref: string): Promise; /** Point HEAD straight at a commit, detaching it from any branch. */ export declare function detachHead(dispatch: Dispatch, gitdir: string, sha: string): Promise; /** * Read every ref a repository publishes, packed and loose. * * Both sources are needed and neither is optional: a freshly cloned repository * keeps `refs/remotes/origin/main` only in `packed-refs`, while a branch * committed to since the last pack exists only as a loose file. Loose wins on a * collision, which is git's own precedence. * * Refs come from two directories when the two differ. A linked worktree shares * its branches with the repository it was cut from and keeps only its own HEAD * and per-checkout refs (`refs/bisect`, `refs/worktree`), so the shared table is * read first and the worktree's own overrides it, then HEAD last of all. * * @param dispatch workspace op dispatcher * @param gitdir this checkout's git directory, which owns HEAD * @param commondir the shared git directory, which owns the branches; null means * it is the same directory, which is every ordinary checkout */ export declare function loadRefs(dispatch: Dispatch, gitdir: string, commondir?: string | null): Promise>; //# sourceMappingURL=refs.d.ts.map