mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
@@ -1231,12 +1231,8 @@ export class Repository implements Disposable {
|
||||
}
|
||||
|
||||
async add(resources: Uri[], opts?: { update?: boolean }): Promise<void> {
|
||||
const config = workspace.getConfiguration('git', Uri.file(this.root));
|
||||
const optimisticUpdate = config.get<boolean>('optimisticUpdate') === true;
|
||||
const operation = optimisticUpdate ? Operation.AddNoProgress : Operation.Add;
|
||||
|
||||
await this.run(
|
||||
operation,
|
||||
this.optimisticUpdateEnabled() ? Operation.AddNoProgress : Operation.Add,
|
||||
async () => {
|
||||
await this.repository.add(resources.map(r => r.fsPath), opts);
|
||||
this.closeDiffEditors([], [...resources.map(r => r.fsPath)]);
|
||||
@@ -1286,12 +1282,8 @@ export class Repository implements Disposable {
|
||||
}
|
||||
|
||||
async revert(resources: Uri[]): Promise<void> {
|
||||
const config = workspace.getConfiguration('git', Uri.file(this.root));
|
||||
const optimisticUpdate = config.get<boolean>('optimisticUpdate') === true;
|
||||
const operation = optimisticUpdate ? Operation.RevertFilesNoProgress : Operation.RevertFiles;
|
||||
|
||||
await this.run(
|
||||
operation,
|
||||
this.optimisticUpdateEnabled() ? Operation.RevertFilesNoProgress : Operation.RevertFiles,
|
||||
async () => {
|
||||
await this.repository.revert('HEAD', resources.map(r => r.fsPath));
|
||||
this.closeDiffEditors([...resources.length !== 0 ?
|
||||
@@ -1401,12 +1393,8 @@ export class Repository implements Disposable {
|
||||
}
|
||||
|
||||
async clean(resources: Uri[]): Promise<void> {
|
||||
const config = workspace.getConfiguration('git', Uri.file(this.root));
|
||||
const optimisticUpdate = config.get<boolean>('optimisticUpdate') === true;
|
||||
const operation = optimisticUpdate ? Operation.CleanNoProgress : Operation.Clean;
|
||||
|
||||
await this.run(
|
||||
operation,
|
||||
this.optimisticUpdateEnabled() ? Operation.CleanNoProgress : Operation.Clean,
|
||||
async () => {
|
||||
const toClean: string[] = [];
|
||||
const toCheckout: string[] = [];
|
||||
@@ -2016,10 +2004,7 @@ export class Repository implements Disposable {
|
||||
const result = await this.retryRun(operation, runOperation);
|
||||
|
||||
if (!isReadOnly(operation)) {
|
||||
const scopedConfig = workspace.getConfiguration('git', Uri.file(this.repository.root));
|
||||
const optimisticUpdate = scopedConfig.get<boolean>('optimisticUpdate') === true;
|
||||
|
||||
await this.updateModelState(optimisticUpdate ? getOptimisticResourceGroups() : undefined);
|
||||
await this.updateModelState(this.optimisticUpdateEnabled() ? getOptimisticResourceGroups() : undefined);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -2481,6 +2466,11 @@ export class Repository implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private optimisticUpdateEnabled(): boolean {
|
||||
const config = workspace.getConfiguration('git', Uri.file(this.root));
|
||||
return config.get<boolean>('optimisticUpdate') === true;
|
||||
}
|
||||
|
||||
public isBranchProtected(name: string = this.HEAD?.name ?? ''): boolean {
|
||||
return this.isBranchProtectedMatcher ? this.isBranchProtectedMatcher(name) : false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user