import { IGitResult as DugiteResult, GitError as DugiteError, IGitExecutionOptions as DugiteExecutionOptions } from 'dugite-no-gpl'; /** * An extension of the execution options in dugite that * allows us to piggy-back our own configuration options in the * same object. */ export interface IGitExecutionOptions extends DugiteExecutionOptions { /** * The exit codes which indicate success to the * caller. Unexpected exit codes will be logged and an * error thrown. Defaults to 0 if undefined. */ readonly successExitCodes?: ReadonlySet; /** * The git errors which are expected by the caller. Unexpected errors will * be logged and an error thrown. */ readonly expectedErrors?: ReadonlySet; /** * `path` is equivalent to `cwd`. * If the `exec` function is set: * - then this will be called instead of the `child_process.execFile`. Clients will **not** have access to the `stdin`. * - then the `USE_LOCAL_GIT` must be set to `"true"`. Otherwise, an error will be thrown. * - the all other properties defined by this option will be ignored except the `env` property. */ readonly exec?: IGitExecutionOptions.ExecFunc; } export declare namespace IGitExecutionOptions { type ExecFunc = (args: string[], options: { cwd: string; stdin?: string; }, callback: (error: Error | null, stdout: string, stderr: string) => void) => void; } /** * The result of using `git`. This wraps dugite's results to provide * the parsed error if one occurs. */ export interface IGitResult extends DugiteResult { /** * The parsed git error. This will be undefined when the exit code is include in * the `successExitCodes`, or when dugite was unable to parse the * error. */ readonly gitError: DugiteError | undefined; /** The human-readable error description, based on `gitError`. */ readonly gitErrorDescription: string | undefined; } export declare class GitError extends Error { /** The result from the failed command. */ readonly result: IGitResult; /** The args for the failed command. */ readonly args: ReadonlyArray; constructor(result: IGitResult, args: ReadonlyArray); } /** * Shell out to git with the given arguments, at the given path. * * @param {args} The arguments to pass to `git`. * * @param {path} The working directory path for the execution of the * command. * * @param {name} The name for the command based on its caller's * context. This will be used for performance * measurements and debugging. * * @param {options} Configuration options for the execution of git, * see IGitExecutionOptions for more information. * * Returns the result. If the command exits with a code not in * `successExitCodes` or an error not in `expectedErrors`, a `GitError` will be * thrown. */ export declare function git(args: string[], path: string, name: string, options?: IGitExecutionOptions): Promise; export declare function gitVersion(options?: IGitExecutionOptions): Promise;