@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
72 lines • 3.73 kB
TypeScript
import type { NOOPAccessor } from '../../../../accessor/base.ts';
import type { PathSpec } from '../../../../types.ts';
import type { CommandFnResult, Context } from '../../../config.ts';
import { type Repo } from './repo.ts';
import { type Advertisement, type Transport } from './transport.ts';
import type { ReadOnlyRefusal } from './types.ts';
/** One remote ref a fetch takes, and where it lands. */
export declare function wanted(remote: string, oid: string, local: string | null, force?: boolean, merge?: boolean, listed?: boolean): {
remote: string;
oid: string;
local: string | null;
force: boolean;
merge: boolean;
listed: boolean;
};
/** One line of git's fetch summary. */
export declare function row(code: string, summary: string, remote: string, local: string, error?: string, counted?: boolean): {
code: string;
summary: string;
remote: string;
local: string;
error: string;
counted: boolean;
};
/** A ref name the way git's fetch summary shortens it. */
export declare function prettify(ref: string): string;
/**
* The `From <url>` block git prints to stderr after a fetch.
*
* Pinned against git 2.47.3 and 2.50.1: the summary column is `2 * abbrev + 3`
* wide and the ref column at least ten, widened by each changed ref whose line
* still fits 80 columns.
*/
export declare function summaryLines(url: string, rows: readonly ReturnType<typeof row>[], abbrev: number): string;
/**
* Drop the refs whose local name git refuses to write.
*
* The remote names its refs, so one it advertises as `refs/tags/../../x` would
* land outside `.git`. git skips such a ref with an error and takes the rest
* (pinned against git 2.50.1). Returns the refs kept and the errors git prints
* for the others.
*/
export declare function ignoreFunny(wants: readonly ReturnType<typeof wanted>[]): [ReturnType<typeof wanted>[], string];
/**
* Bring in every wanted object, then the tags that follow them. Two rounds, as
* git does: the refs first, then any annotated tag whose target is now here but
* whose tag object is not.
*/
export declare function fetchObjects(repo: Repo, transport: Transport, adv: Advertisement, wants: readonly ReturnType<typeof wanted>[], follow: boolean): Promise<[Repo, ReturnType<typeof wanted>[]]>;
/** Move each local ref, returning the summary rows and any rejection. */
export declare function updateRefs(repo: Repo, wants: readonly ReturnType<typeof wanted>[], reason: string, logged: boolean): Promise<[ReturnType<typeof row>[], boolean]>;
/** FETCH_HEAD: every listed ref, the ones marked for merge first. */
export declare function fetchHead(url: string, wants: readonly ReturnType<typeof wanted>[]): string;
/** `http.extraHeader` from the user's config, then the repository's. */
export declare function configuredHeaders(ctx: Context, repo: Repo | null): Promise<Record<string, string>>;
/** The words after the verb, which git's reflog reason repeats. */
export declare function leafArgs(argv: readonly string[], verb: string): readonly string[];
/**
* Download objects and refs from another repository.
*
* Reaches a repository in the workspace through the dispatcher and an
* `https://` remote over smart HTTP. Updates the remote-tracking refs a
* remote's refspecs name, follows the tags that point into what arrived, writes
* FETCH_HEAD, and prints git's summary to stderr.
*/
export declare function fetch(_accessor: NOOPAccessor, paths: PathSpec[], texts: string[], ctx: Context): Promise<CommandFnResult>;
/**
* fetch's refusal by a read-only mount, at FETCH_HEAD, named the way git names
* it from the top of the work tree.
*/
export declare const fetchReadOnly: ReadOnlyRefusal;
//# sourceMappingURL=fetch.d.ts.map