提交 f367d0fe 编写于 作者: J Joao Moreno

skip auth only for auto fetch

related to #72615
上级 612b0723
......@@ -28,6 +28,10 @@ function main(argv: string[]): void {
return fatal('Missing pipe');
}
if (process.env['VSCODE_GIT_COMMAND'] === 'fetch' && !!process.env['VSCODE_GIT_FETCH_SILENT']) {
return fatal('Skip silent fetch commands');
}
const output = process.env['VSCODE_GIT_ASKPASS_PIPE'] as string;
const socketPath = process.env['VSCODE_GIT_ASKPASS_HANDLE'] as string;
const request = argv[2];
......
......@@ -99,7 +99,7 @@ export class AutoFetcher {
}
try {
await this.repository.fetchDefault();
await this.repository.fetchDefault({ silent: true });
} catch (err) {
if (err.gitErrorCode === GitErrorCodes.AuthenticationFailed) {
this.disable();
......
......@@ -1401,8 +1401,9 @@ export class Repository {
await this.run(args);
}
async fetch(options: { remote?: string, ref?: string, all?: boolean, prune?: boolean, depth?: number } = {}): Promise<void> {
async fetch(options: { remote?: string, ref?: string, all?: boolean, prune?: boolean, depth?: number, silent?: boolean } = {}): Promise<void> {
const args = ['fetch'];
const spawnOptions: SpawnOptions = {};
if (options.remote) {
args.push(options.remote);
......@@ -1422,8 +1423,12 @@ export class Repository {
args.push(`--depth=${options.depth}`);
}
if (options.silent) {
spawnOptions.env = { 'VSCODE_GIT_FETCH_SILENT': 'true' };
}
try {
await this.run(args);
await this.run(args, spawnOptions);
} catch (err) {
if (/No remote repository specified\./.test(err.stderr || '')) {
err.gitErrorCode = GitErrorCodes.NoRemoteRepositorySpecified;
......
......@@ -1054,8 +1054,8 @@ export class Repository implements Disposable {
}
@throttle
async fetchDefault(): Promise<void> {
await this.run(Operation.Fetch, () => this.repository.fetch());
async fetchDefault(options: { silent?: boolean } = {}): Promise<void> {
await this.run(Operation.Fetch, () => this.repository.fetch(options));
}
@throttle
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册