🐛 make askpass work in no-workspace environment

fixes #23474
This commit is contained in:
Joao Moreno
2017-03-29 12:11:26 +02:00
parent d4d039f78b
commit 12470dccf6
3 changed files with 13 additions and 22 deletions

View File

@@ -250,6 +250,7 @@ export class GitError {
export interface IGitOptions {
gitPath: string;
version: string;
env?: any;
}
export const GitErrorCodes = {
@@ -276,6 +277,7 @@ export class Git {
private gitPath: string;
private version: string;
private env: any;
private _onOutput = new EventEmitter<string>();
get onOutput(): Event<string> { return this._onOutput.event; }
@@ -283,10 +285,11 @@ export class Git {
constructor(options: IGitOptions) {
this.gitPath = options.gitPath;
this.version = options.version;
this.env = options.env || {};
}
open(repository: string, env: any = {}): Repository {
return new Repository(this, repository, env);
open(repository: string): Repository {
return new Repository(this, repository);
}
async init(repository: string): Promise<void> {
@@ -374,7 +377,7 @@ export class Git {
options.stdio = ['ignore', null, null]; // Unless provided, ignore stdin and leave default streams for stdout and stderr
}
options.env = assign({}, process.env, options.env || {}, {
options.env = assign({}, process.env, this.env, options.env || {}, {
VSCODE_GIT_COMMAND: args[0],
LC_ALL: 'en_US',
LANG: 'en_US.UTF-8'
@@ -401,8 +404,7 @@ export class Repository {
constructor(
private _git: Git,
private repositoryRoot: string,
private env: any = {}
private repositoryRoot: string
) { }
get git(): Git {
@@ -415,23 +417,14 @@ export class Repository {
// TODO@Joao: rename to exec
async run(args: string[], options: any = {}): Promise<IExecutionResult> {
options.env = assign({}, options.env || {});
options.env = assign(options.env, this.env);
return await this.git.exec(this.repositoryRoot, args, options);
}
stream(args: string[], options: any = {}): cp.ChildProcess {
options.env = assign({}, options.env || {});
options.env = assign(options.env, this.env);
return this.git.stream(this.repositoryRoot, args, options);
}
spawn(args: string[], options: any = {}): cp.ChildProcess {
options.env = assign({}, options.env || {});
options.env = assign(options.env, this.env);
return this.git.spawn(args, options);
}