import type { CommandFnResult } from '../../../config.ts'; import type { FlagView } from '../../../spec/types.ts'; import type { GitError } from './errors.ts'; /** * Where repository discovery begins for this invocation. * * `-C` changes directory before anything else happens, git's own reading of the * option. It needs no separate session-cwd fact: the option is declared with a * `'.'` default, and a PATH default lands as if typed, so an absent `-C` * resolves to the session cwd and a relative `-C build` is already absolute by * the time it arrives. * * Read as a string, not a PathSpec: group-level values are resolved by the walk * and reach a leaf as absolute virtual paths, while a leaf's own PATH flags are * recovered as PathSpec by parseFlags. * * @param fl spec-validated view over the leaf's flag bag */ export declare function startPoint(fl: FlagView): string; /** * The revision operand a verb was given, or git's own default. * * @param texts positional text operands * @param fallback what an absent operand means */ export declare function revisionArg(texts: readonly string[], fallback?: string): string; /** * Refuse an operand that is really an option this build lacks. * * A verb taking a revision accepts free text, so every flag mirage does not * declare reaches it as one. Resolving it as a revision is the wrong answer * twice over: it fails, and it fails saying the repository has no such commit, * when what happened is that mirage has no such flag. Refused here, before any * object is read, so the message names the real problem. * * A pathspec is not checked for and cannot be: the shared parser consumes `--` * as its end-of-options marker, so `log -- a.txt` and `log a.txt` reach a leaf * identically. Both resolve the operand as a revision and fail with git's own * "unknown revision or path" wording, which is exactly right for an untracked * path and a deliberate divergence for a tracked one, where git would narrow the * walk instead. Erring is the safe half of that trade: limiting by nothing would * print every commit and look like an answer. * * Which refusal to raise is the caller's, because git words this differently per * verb and means each one: see UnknownSwitchError for the three. * * @param texts positional text operands, as typed * @param error the refusal this verb words it with */ export declare function checkOperands(texts: readonly string[], error?: new (argument: string) => GitError): void; /** * Render a git error: `: `, on its own stream. * * git uses 128 for a fatal, which is neither the dispatcher's usage exit (2) nor * its generic handler-error exit (1), so leaves return the code rather than * throwing into the catch-all. A refused option carries its own prefix and code * instead, which is git's own split, and a refusal that is really a report * ("nothing to commit") carries no prefix and goes to stdout. * * @param exc the error to render */ export declare function fatal(exc: GitError): CommandFnResult; //# sourceMappingURL=util.d.ts.map