@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
46 lines • 2.22 kB
TypeScript
import { PathSpec } from '../../../../types.ts';
import type { RepoLocation } from './types.ts';
import type { Files } from '../../../../workspace/files.ts';
/**
* Find the repository governing a path, or throw git's own fatal.
*
* Walks up from `start` looking for a `.git` entry, stopping at the mount root.
* Real git stops discovery at a filesystem boundary unless
* GIT_DISCOVERY_ACROSS_FILESYSTEM is set, and a mount prefix is exactly that
* boundary: crossing it would probe a different backend for a repository that
* has nothing to do with the operand.
*
* Existence comes from `statPath` rather than one backend's stat because on a
* prefix store a directory is not an object: `.git` answers on readdir while a
* point lookup misses it entirely. That is the same fact `find` asks about its
* own start point.
*
* What is found is not always the git directory. A `.git` file points at one
* elsewhere, and the directory it points at may share its objects with another,
* so the three paths are resolved here and carried separately rather than
* derived again by each verb.
*
* @param vfs the session's files
* @param start absolute virtual path to start from, normally the session cwd or
* the argument of `-C`
*/
export declare function discover(vfs: Files, start: PathSpec, gitdir?: PathSpec | null, worktree?: PathSpec | null): Promise<RepoLocation>;
/**
* Whether core.bare leaves the repository without a work tree.
*
* git reads core.bare, like core.worktree, only from a repository's own config,
* and a linked worktree's config is its repository's, so a linked worktree is
* never bare. A named work tree overrides it.
*/
export declare function isBare(vfs: Files, location: RepoLocation): Promise<boolean>;
/**
* Refuse, in git's words, when there is no work tree to enter.
*
* Asked by every verb that reads or writes working files, so a bare repository
* or a mistyped `--work-tree` is refused rather than read as a tree with every
* file deleted.
*
* @param named `--work-tree` or `GIT_WORK_TREE` chose the tree
*/
export declare function requireWorkTree(vfs: Files, location: RepoLocation, named: boolean): Promise<void>;
//# sourceMappingURL=discover.d.ts.map