export declare const FULL_SHA = 40; /** A commit as far as rendering is concerned, whoever read it. */ export interface CommitFacts { readonly oid: string; readonly tree: string; readonly message: string; readonly authorName: string; readonly authorEmail: string; /** Seconds since the epoch. */ readonly authorTime: number; /** The author's UTC offset in minutes, git's own sign convention. */ readonly authorTimezoneMinutes: number; readonly committerName: string; readonly committerEmail: string; readonly committerTime: number; readonly committerTimezoneMinutes: number; readonly parents: readonly string[]; } /** Ref labels per commit id, for %d/%D. */ export type Decorations = ReadonlyMap; /** * The parsed value of `--pretty`/`--format`. * * `kind` is a preset name, or `format`/`tformat` for a placeholder template: * `format` separates entries with a newline while `tformat` terminates each * with one, and is what a bare `%` string means. */ export interface LogFormat { readonly kind: string; readonly template: string | null; } export declare const MEDIUM: LogFormat; /** * Read a --pretty/--format value the way git's pretty.c does. * * @throws UnsupportedPrettyError for a real git preset this build lacks * @throws BadPrettyError for a name git itself would refuse */ export declare function parsePretty(value: string): LogFormat; /** * Whether rendering this format has to know the refs. * * Only `%d`/`%D` read them; git turns decorations off for piped preset * output, which is the only output mirage produces. */ export declare function needsDecorations(fmt: LogFormat): boolean; /** * How many hex digits an abbreviated id needs in a repository. * * git widens the abbreviation as a repository grows, so `--oneline` on a large * repository prints nine characters where a fresh one prints seven, and a build * that always printed seven disagreed with real git on every line of every big * repository. * * Measured against git 2.50.1 rather than read off its source, and the boundary * is sharp: 16,383 packed objects abbreviate to 7 and 16,384 to 8, which is one * hex digit per two bits of object count, floored at git's seven. Confirmed * again at 20,102 (8), 70,102 (9) and 184,401 (9). * * Only packed objects count. The same 70,102 objects abbreviate to 7 while loose * and to 9 once packed, which is consistent with it being an estimate: a pack * index states its object count in its header, while counting loose objects * means walking 256 directories. * * @param packed how many objects the repository's packs hold */ export declare function abbrevLength(packed: number): number; /** * Abbreviate an object id the way `--oneline` prints it. * * @param sha hex object id * @param length how many hex digits to keep, from abbrevLength */ export declare function short(sha: string, length?: number): string; /** * One `--oneline` row: abbreviated id then subject. * * @param commit the commit to render * @param length how many hex digits of the id to print */ export declare function oneline(commit: CommitFacts, length?: number): string; /** * One commit as a block preset renders it (short/medium/full/fuller). * * Pinned against git 2.50: `short` is the id, author and indented subject; * `full` adds `Commit:` and drops both dates; `fuller` aligns four header * lines to the `AuthorDate:` column. */ export declare function presetBlock(commit: CommitFacts, kind: string, length: number): string[]; /** * Expand a format:/tformat: template for one commit. * * The scan mirrors git's pretty.c behavior pinned in docker: an unknown or * incomplete placeholder stays verbatim (`%q` prints `%q`), `%%` is a literal * percent, and `%xHH` names a raw output byte (`%x80` is the single byte * 0x80, carried by the shell's byte-escape convention until `encodeText` * writes it). Explicit cursor, one pass, like the stat -c engine. */ export declare function renderTemplate(template: string, commit: CommitFacts, length: number, decor: Decorations | null): string; //# sourceMappingURL=format.d.ts.map