git api: make cwd mandatory

This commit is contained in:
Joao Moreno
2018-08-22 13:06:26 +02:00
parent a49378e26c
commit f9982d29d4
3 changed files with 10 additions and 6 deletions

View File

@@ -36,12 +36,11 @@ export class ApiGit implements Git {
constructor(private _model: Model) { }
exec(cwd: string, args: string[], options: SpawnOptions = {}): Promise<ExecResult<string>> {
return this._model.git.exec(cwd, args, options);
exec(args: string[], options: SpawnOptions): Promise<ExecResult<string>> {
return this._model.git.exec2(args, options);
}
spawn(cwd: string, args: string[], options: SpawnOptions = {}): cp.ChildProcess {
options = { cwd, ...options };
spawn(args: string[], options: SpawnOptions): cp.ChildProcess {
return this._model.git.spawn(args, options);
}
}

View File

@@ -13,6 +13,7 @@ export interface ExecResult<T extends string | Buffer> {
}
export interface SpawnOptions extends cp.SpawnOptions {
readonly cwd: string;
readonly input?: string;
readonly encoding?: string;
readonly log?: boolean;
@@ -21,8 +22,8 @@ export interface SpawnOptions extends cp.SpawnOptions {
export interface Git {
readonly path: string;
exec(cwd: string, args: string[], options?: SpawnOptions): Promise<ExecResult<string>>;
spawn(cwd: string, args: string[], options?: SpawnOptions): cp.ChildProcess;
exec(args: string[], options: SpawnOptions): Promise<ExecResult<string>>;
spawn(args: string[], options: SpawnOptions): cp.ChildProcess;
}
export interface API {