import { type CommitFacts } from './format.ts';
import { gitFs } from './fs.ts';
import type { RefObject, RepoLocation } from './types.ts';
import type { Files } from '../../../../workspace/files.ts';
/**
 * A repository living in a mount, opened for reading.
 *
 * `fs` is the whole bridge: isomorphic-git reaches every byte through it, so its
 * own algorithms (history walk, tree diff, three-way merge) run against a mount
 * without ever learning that one exists. Nothing here is loaded eagerly, which
 * is also what git does.
 *
 * Objects come from the common directory and refs from both: a linked worktree
 * shares the object database and the branches of the repository it was cut from,
 * and owns only HEAD and whatever refs are per-checkout.
 */
export interface Repo {
    readonly fs: ReturnType<typeof gitFs>;
    readonly vfs: Files;
    readonly location: RepoLocation;
    /** Parsed packs shared by this invocation, never retained across commands. */
    readonly cache: Record<symbol, unknown>;
    /** How many hex digits this repository abbreviates an id to. */
    readonly abbrev: number;
    /** Blobs this invocation hashed from the working tree and never wrote. */
    readonly held: Map<string, Uint8Array>;
    /**
     * Where resolving a name two refs answer to puts git's `refname is
     * ambiguous` warning, for the verb to print ahead of its own stderr; null
     * when `core.warnAmbiguousRefs` is off or nothing collects them.
     */
    readonly ambiguous: string[] | null;
    /**
     * Where this command found each tree and blob it was shown,
     * repository-relative (`seen.ts`).
     */
    readonly places: Map<string, string>;
    /**
     * Whether a hide or a rule could cover anything in the working tree for the
     * running command, once asked (`guarded`); null until then.
     */
    guarded: boolean | null;
    /** The place each operand's own path gave the object it names (`placeNamed`). */
    readonly named: Map<string, string>;
    /**
     * Blobs this command listed only at places a rule keeps from it, each with
     * the first such place.
     */
    readonly sealed: Map<string, string>;
    /** Blobs it listed where it may read them. */
    readonly free: Set<string>;
    /** Every place the shared history walk has sighted each object at so far (`seen.ts`). */
    readonly seen: Map<string, string[]>;
    /** That walk, resumed by each lookup; null until one starts it. */
    sightings: AsyncGenerator<[string, string], void> | null;
}
/** The argument bag every isomorphic-git call in this package shares. */
export declare function repoArgs(repo: Repo): {
    fs: never;
    dir: string;
    gitdir: string;
    cache: Repo['cache'];
};
/**
 * Every id, loose or packed, starting with a two-digit fanout prefix, sorted.
 * Nothing is read but each pack index's bucket for that byte and the one loose
 * directory, which is what widening abbreviated ids needs.
 *
 * @param fanout two lowercase hex digits
 */
export declare function idsUnder(repo: Repo, fanout: string): Promise<string[]>;
/** An object's type and its bytes as stored, whichever kind of object it is. */
export declare function rawObject(repo: Repo, oid: string): Promise<RefObject>;
/** Which of commit/tag/tree/blob an id names, null when the repository lacks it. */
export declare function objectType(repo: Repo, oid: string): Promise<string | null>;
/**
 * Keep a fetched pack whole, beside the index git reads it through.
 *
 * Named by the pack's own checksum, as git names one it receives, and indexed
 * after the pack is written, so a reader that lists `.idx` files never finds
 * one whose pack is not there yet. An empty pack stores nothing.
 */
export declare function storePack(repo: Repo, data: Uint8Array): Promise<void>;
/**
 * Open a repository living in a mount.
 *
 * @param vfs the session's files
 * @param location the discovered repository
 */
export declare function openRepo(vfs: Files, location: RepoLocation, ambiguous?: string[] | null): Promise<Repo>;
/**
 * A blob's bytes, a held one first: what `git diff` hashes from the working
 * tree is rendered like any blob, but git writes none of it. Mirrors
 * Python's VfsObjectStore.hold.
 */
export declare function readBlobBytes(repo: Repo, oid: string): Promise<Uint8Array>;
/**
 * One commit's metadata and message from a single object read. The message
 * retains its stored newlines; identity offsets are minutes east of UTC.
 */
export declare function commitFacts(repo: Repo, oid: string): Promise<CommitFacts>;
/**
 * A boolean from the repository's config, read the way git reads one.
 *
 * @param repo the opened repository
 * @param path the variable, e.g. `core.quotepath`
 * @param fallback the answer when the variable is unset
 */
export declare function configBool(repo: Repo, path: string, fallback: boolean): Promise<boolean>;
//# sourceMappingURL=repo.d.ts.map