mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 09:18:59 +00:00
Git - Add button/setting to always replace local tags in case of a conflict during the pull operation (#205148)
This commit is contained in:
parent
71bd033d63
commit
9576c1a7c5
|
@ -2645,6 +2645,12 @@
|
|||
"default": false,
|
||||
"description": "%config.followTagsWhenSync%"
|
||||
},
|
||||
"git.replaceTagsWhenPull": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": false,
|
||||
"description": "%config.replaceTagsWhenPull%"
|
||||
},
|
||||
"git.promptToSaveFilesBeforeStash": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
|
|
|
@ -176,6 +176,7 @@
|
|||
"config.decorations.enabled": "Controls whether Git contributes colors and badges to the Explorer and the Open Editors view.",
|
||||
"config.enableStatusBarSync": "Controls whether the Git Sync command appears in the status bar.",
|
||||
"config.followTagsWhenSync": "Push all annotated tags when running the sync command.",
|
||||
"config.replaceTagsWhenPull": "Automatically replace the local tags with the remote tags in case of a conflict when running the pull command.",
|
||||
"config.promptToSaveFilesBeforeStash": "Controls whether Git should check for unsaved files before stashing changes.",
|
||||
"config.promptToSaveFilesBeforeStash.always": "Check for any unsaved files.",
|
||||
"config.promptToSaveFilesBeforeStash.staged": "Check only for unsaved staged files.",
|
||||
|
|
|
@ -2630,13 +2630,23 @@ export class Repository implements Disposable {
|
|||
throw new Error(`Unable to extract tag names from error message: ${raw}`);
|
||||
}
|
||||
|
||||
// Notification
|
||||
const replaceLocalTags = l10n.t('Replace Local Tag(s)');
|
||||
const message = l10n.t('Unable to pull from remote repository due to conflicting tag(s): {0}. Would you like to resolve the conflict by replacing the local tag(s)?', tags.join(', '));
|
||||
const choice = await window.showErrorMessage(message, { modal: true }, replaceLocalTags);
|
||||
const config = workspace.getConfiguration('git', Uri.file(this.repository.root));
|
||||
const replaceTagsWhenPull = config.get<boolean>('replaceTagsWhenPull', false) === true;
|
||||
|
||||
if (choice !== replaceLocalTags) {
|
||||
return false;
|
||||
if (!replaceTagsWhenPull) {
|
||||
// Notification
|
||||
const replaceLocalTags = l10n.t('Replace Local Tag(s)');
|
||||
const replaceLocalTagsAlways = l10n.t('Always Replace Local Tag(s)');
|
||||
const message = l10n.t('Unable to pull from remote repository due to conflicting tag(s): {0}. Would you like to resolve the conflict by replacing the local tag(s)?', tags.join(', '));
|
||||
const choice = await window.showErrorMessage(message, { modal: true }, replaceLocalTags, replaceLocalTagsAlways);
|
||||
|
||||
if (choice !== replaceLocalTags && choice !== replaceLocalTagsAlways) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (choice === replaceLocalTagsAlways) {
|
||||
await config.update('replaceTagsWhenPull', true, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Force fetch tags
|
||||
|
|
Loading…
Reference in a new issue