This commit is contained in:
João Moreno 2020-11-04 15:42:40 +01:00
parent 90aa30e660
commit e5285908ca
No known key found for this signature in database
GPG key ID: 896B853774D1A575
2 changed files with 10 additions and 13 deletions

View file

@ -146,7 +146,7 @@
"config.confirmEmptyCommits": "Always confirm the creation of empty commits for the 'Git: Commit Empty' command.",
"config.fetchOnPull": "When enabled, fetch all branches when pulling. Otherwise, fetch just the current one.",
"config.pullTags": "Fetch all tags when pulling.",
"config.pruneOnFetch": "Always prune when fetching.",
"config.pruneOnFetch": "Prune when fetching.",
"config.autoStash": "Stash any changes before pulling and restore them after successful pull.",
"config.allowForcePush": "Controls whether force push (with or without lease) is enabled.",
"config.useForcePushWithLease": "Controls whether force pushing uses the safer force-with-lease variant.",

View file

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