/** * Base for a git fatal: rendered as `fatal: `, exit 128. * * Subclasses override `prefix`, `code` and `stream` when git words their case * differently, so every verb can keep one `instanceof GitError` arm and the * rendering stays in one place. A null prefix prints the message alone, which is * what git does when the refusal is a report rather than an error ("nothing to * commit"), and such a report goes to stdout because that is where the report it * replaces would have gone. */ export declare class GitError extends Error { readonly prefix: string | null; readonly code: number; readonly stream: 'stdout' | 'stderr'; } /** * No `.git` at the start point or above it, up to the mount root. * * git quotes a path the user typed (`--git-dir`, `GIT_DIR`) and leaves unquoted * one it read out of a `.git` file, pinned against git 2.50.1. */ export declare class NotARepositoryError extends GitError { constructor(gitdir?: string | null, quoted?: boolean); } /** A `.git` file that is not a `gitdir:` pointer. */ export declare class InvalidGitFileError extends GitError { constructor(path: string); } /** * A revision that resolves to nothing. * * git answers every unresolvable revision with one wording, whether the ref is * unknown, the short sha matches nothing, or an ancestry step walked off the end * of history (pinned against git 2.47.3 for `show`, `log` and `rev-parse` * alike). */ export declare class AmbiguousArgumentError extends GitError { constructor(revision: string); } /** * A date flag whose value could not be read. * * git accepts relative wording (`2 weeks ago`) that mirage does not, so an * unreadable value is refused rather than ignored: silently dropping the flag * would widen the window instead of narrowing it. */ export declare class BadDateError extends GitError { constructor(flag: string, value: string); } /** * The CLI ran with no workspace behind it, so no file is reachable. * * Only possible when a leaf is called directly in a unit test: inside a * workspace the dispatcher always offers the facts a leaf declares. */ export declare class NoWorkspaceError extends GitError { constructor(); } /** * `-C` named a path git could not enter. * * Two reasons, both in git's own wording: nothing is there, or something is and * it is not a directory. The second matters as much as the first, because * discovery walks upwards from the start point: a file operand that is merely * tolerated finds the repository above it and quietly runs there instead. */ export declare class NoWorkingDirectoryError extends GitError { constructor(path: string, reason?: string); } /** * `checkout -b` given a start point that is not a commit. * * git blames the start point rather than the branch name, and says so in one * sentence naming both, which is more use than the generic "ambiguous argument" * the same lookup failure produces elsewhere. */ export declare class BadStartPointError extends GitError { constructor(start: string, name: string); } /** * `reset` given a revision, which this build does not take. * * Real git resets the index to any commit named here. mirage resets it from * HEAD only, so the operand has nothing to do, and doing nothing quietly is the * one answer a caller cannot act on: a script reads the zero exit as "the index * was reset" when it was not. Saying which feature is missing beats reusing * "unknown revision" for a revision that is perfectly well known. */ export declare class RevisionResetError extends GitError { constructor(revision: string); } /** * A dashed operand, which is a git feature this build does not have. * * mirage implements a subset of every verb, so an undeclared flag is rarely a * typo: it is a real git option (`-p`, `--graph`, `--follow`) arriving at a * build that lacks it. Left alone it lands on the revision operand and comes * back as "ambiguous argument", which blames the repository for missing a * commit rather than mirage for missing a feature, and an agent reading that * draws the wrong conclusion. git words the same mistake this way for `log` * and `show`. */ export declare class UnrecognizedArgumentError extends GitError { constructor(argument: string); } /** * A --pretty/--format value naming no format at all. * * git's own wording and exit code for a name it has never heard of. */ export declare class BadPrettyError extends GitError { constructor(value: string); } /** * A --pretty/--format preset git has but this build does not. * * `raw`, `email`, `mboxrd` and `reference` are real git formats; answering * "invalid" for them would gaslight an agent that spelled a valid one, so the * refusal says unsupported and names what exists instead. */ export declare class UnsupportedPrettyError extends GitError { constructor(value: string); } /** A path operand that resolves outside the working tree. */ export declare class OutsideRepositoryError extends GitError { constructor(operand: string, root: string); } /** A path operand that matches nothing in the working tree. */ export declare class PathspecError extends GitError { constructor(pathspec: string); } /** * Explicitly named paths that an ignore rule covers. * * git refuses rather than staging them, because naming an ignored path is far * more often a mistake than an intention, and exits 1 rather than its usual 128. * Expanding a directory is not the same act: there the ignored files are * silently skipped, which is why only operands that name a file reach this. */ export declare class IgnoredPathsError extends GitError { readonly prefix: null; readonly code = 1; constructor(paths: readonly string[]); } /** * `add` with no pathspec at all. Not an error by exit code: git says what it did * not do and exits 0, because nothing went wrong and nothing happened. */ export declare class NothingSpecifiedError extends GitError { readonly prefix: null; readonly code = 0; constructor(); } /** * `commit` with an index that matches HEAD. Printed on stdout, where the status * report it stands in for would have gone, and exits 1. */ export declare class NothingToCommitError extends GitError { readonly prefix: null; readonly code = 1; readonly stream = "stdout"; constructor(report: string); } /** * `commit` with no `-m`. * * git would open an editor here. A mount has no editor to open and no terminal * to open it on, and inventing a message would put an unreviewed sentence into * history, so the flag is required rather than defaulted. */ export declare class MissingMessageError extends GitError { constructor(); } /** `commit` while paths are still in conflict. */ export declare class UnmergedIndexError extends GitError { constructor(); } /** `branch ` naming a branch that is already there. */ export declare class BranchExistsError extends GitError { constructor(name: string); } /** `branch -d` with nothing to delete. */ export declare class BranchNameRequiredError extends GitError { readonly prefix = "error"; readonly code = 129; constructor(); } /** `branch -d` naming the branch HEAD is on. */ export declare class CheckedOutBranchError extends GitError { readonly prefix = "error"; readonly code = 1; constructor(name: string, worktree: string); } /** * `-d` naming a branch whose commits HEAD does not already hold. * * The branch name is the only thing pointing at those commits, so deleting it * leaves them unreachable and there is no reflog here to find them again. git * refuses for that reason and reserves `-D` for a caller who means it, which is * why `-d` alone would be the wrong shape to ship: it would be a delete with no * way to say no. * * Only the first of git's two hint lines is kept. The second names the config * knob that silences the advice, and there is no git config here to set. */ export declare class UnmergedBranchError extends GitError { readonly prefix = "error"; readonly code = 1; constructor(name: string); } /** A branch name that resolves to nothing. */ export declare class NoBranchError extends GitError { readonly prefix = "error"; readonly code = 1; constructor(name: string); } /** * An operand that is neither a ref nor a path git has heard of. * * One sentence, two exit codes, which is git's own split rather than ours: * `checkout` refuses with 1, and `add -u` treats the same sentence as a fatal * and exits 128. Measured one verb at a time on git 2.50.1. */ export declare class UnknownPathspecError extends GitError { readonly prefix = "error"; readonly code: number; constructor(target: string, fatal?: boolean); } /** * A checkout that would throw away work that is not committed. * * git refuses and names every file rather than overwriting, which is the one * safety check that makes checkout usable at all: without it a branch switch * silently destroys whatever was edited and not staged. * * Two kinds of work are at risk and git words them differently: a tracked file * carrying uncommitted changes, and an untracked file the target branch would * write over. Both are carried here rather than thrown separately because when * both apply git prints both paragraphs and aborts once, pinned against git * 2.50. */ export declare class CheckoutConflictError extends GitError { readonly prefix = "error"; readonly code = 1; constructor(local: readonly string[], untracked: readonly string[]); } /** * The wording of git's own option parser, used by most verbs. * * Three verbs word this three ways and git means all of them: `log` and `show` * say "unrecognized argument" and exit 128, `diff` says "invalid option" and * exits 129, and everything built on parse-options (`status`, `add`, `branch`, * `reset`, `checkout`, `commit`) says this and exits 129. Measured on git 2.47, * one verb at a time. */ export declare class UnknownSwitchError extends GitError { readonly prefix = "error"; readonly code = 129; constructor(argument: string); } /** * `diff`'s wording for an option it does not know. * * Same mistake as UnrecognizedArgumentError and a different sentence, because * git itself words it differently here and exits 129 rather than 128. Pinned * against git 2.50.1. */ export declare class InvalidOptionError extends GitError { readonly prefix = "error"; readonly code = 129; constructor(argument: string); } //# sourceMappingURL=errors.d.ts.map