mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-30 02:02:41 +01:00
git.pruneOnFetch setting implemented
This commit is contained in:
@@ -1548,6 +1548,12 @@
|
||||
"default": false,
|
||||
"description": "%config.fetchOnPull%"
|
||||
},
|
||||
"git.pruneOnFetch": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": false,
|
||||
"description": "%config.pruneOnFetch%"
|
||||
},
|
||||
"git.pullTags": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
|
||||
@@ -128,6 +128,7 @@
|
||||
"config.confirmEmptyCommits": "Always confirm the creation of empty commits for the 'Git: Commit Empty' command.",
|
||||
"config.fetchOnPull": "Fetch all branches when pulling or just the current one.",
|
||||
"config.pullTags": "Fetch all tags when pulling.",
|
||||
"config.pruneOnFetch": "Always 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.",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user