git.pruneOnFetch setting implemented

This commit is contained in:
Oliver Larsson
2020-01-24 21:20:44 +01:00
parent a93ffac38a
commit 2abdb90472
3 changed files with 24 additions and 4 deletions

View File

@@ -1072,21 +1072,34 @@ export class Repository implements Disposable {
@throttle
async fetchDefault(options: { silent?: boolean } = {}): Promise<void> {
await this.run(Operation.Fetch, () => this.repository.fetch(options));
await this.fetchFrom({ silent: options.silent });
}
@throttle
async fetchPrune(): Promise<void> {
await this.run(Operation.Fetch, () => this.repository.fetch({ prune: true }));
await this.fetchFrom({ prune: true });
}
@throttle
async fetchAll(): Promise<void> {
await this.run(Operation.Fetch, () => this.repository.fetch({ all: true }));
await this.fetchFrom({ all: true });
}
async fetch(remote?: string, ref?: string, depth?: number): Promise<void> {
await this.run(Operation.Fetch, () => this.repository.fetch({ remote, ref, depth }));
await this.fetchFrom({ remote, ref, depth });
}
private async fetchFrom(options: { remote?: string, ref?: string, all?: boolean, prune?: boolean, depth?: number, silent?: boolean } = {}): Promise<void> {
await this.run(Operation.Fetch, async () => {
const config = workspace.getConfiguration('git', Uri.file(this.root));
const prune = config.get<boolean>('pruneOnFetch');
if (prune) {
options.prune = prune;
}
this.repository.fetch(options);
});
}
@throttle