diff --git a/extensions/git/package.json b/extensions/git/package.json index 2954dec552a..e5604518397 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1893,26 +1893,6 @@ "default": [], "scope": "resource" }, - "git.branchProtectionIndicator": { - "type": "object", - "additionalProperties": false, - "description": "%config.branchProtectionIndicator%", - "properties": { - "quickOpen": { - "type": "boolean", - "description": "%config.branchProtectionIndicator.quickOpen%" - }, - "statusBar": { - "type": "boolean", - "description": "%config.branchProtectionIndicator.statusBar%" - } - }, - "default": { - "quickOpen": true, - "statusBar": true - }, - "scope": "resource" - }, "git.branchProtectionPrompt": { "type": "string", "description": "%config.branchProtectionPrompt%", diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 5b49bb6c238..d17b31b71be 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -122,9 +122,6 @@ "config.checkoutType.remote": "Remote branches", "config.branchPrefix": "Prefix used when creating a new branch.", "config.branchProtection": "List of protected branches. By default, a prompt is shown before changes are committed to a protected branch. The prompt can be controlled using the `#git.branchProtectionPrompt#` setting.", - "config.branchProtectionIndicator": "Controls whether an indicator is being displayed for a protected branch.", - "config.branchProtectionIndicator.quickOpen": "Display an indicator in the quick open.", - "config.branchProtectionIndicator.statusBar": "Display an indicator in the status bar.", "config.branchProtectionPrompt": "Controls whether a prompt is being before changes are committed to a protected branch.", "config.branchProtectionPrompt.alwaysCommit": "Always commit changes to the protected branch.", "config.branchProtectionPrompt.alwaysCommitToNewBranch": "Always commit changes to a new branch.", diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index b7c66acb7bb..c46aaa13c57 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -26,7 +26,7 @@ const localize = nls.loadMessageBundle(); class CheckoutItem implements QuickPickItem { protected get shortCommit(): string { return (this.ref.commit || '').substr(0, 8); } - get label(): string { return this.ref.name ? `${this.ref.name}${this.repository.isBranchProtected(this.ref.name, 'quickOpen') ? ' $(lock-small)' : ''}` : this.shortCommit; } + get label(): string { return this.ref.name ? `${this.ref.name}${this.repository.isBranchProtected(this.ref.name) ? ' $(lock-small)' : ''}` : this.shortCommit; } get description(): string { return this.shortCommit; } constructor(protected repository: Repository, protected ref: Ref) { } diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 3451b9c8a9f..e6166c8ca12 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -942,7 +942,6 @@ export class Repository implements Disposable { filterEvent(workspace.onDidChangeConfiguration, e => e.affectsConfiguration('git.branchProtection', root) - || e.affectsConfiguration('git.branchProtectionIndicator', root) || e.affectsConfiguration('git.branchSortOrder', root) || e.affectsConfiguration('git.untrackedChanges', root) || e.affectsConfiguration('git.ignoreSubmodules', root) @@ -2230,17 +2229,7 @@ export class Repository implements Disposable { } } - public isBranchProtected(name: string = this.HEAD?.name ?? '', indicator?: 'quickOpen' | 'statusBar'): boolean { - if (indicator) { - const scopedConfig = workspace.getConfiguration('git', Uri.file(this.repository.root)); - const branchProtectionIndicator = scopedConfig.get<{ quickOpen: boolean; statusBar: boolean }>('branchProtectionIndicator', { quickOpen: true, statusBar: true }); - - if ((indicator === 'quickOpen' && !branchProtectionIndicator.quickOpen) || - (indicator === 'statusBar' && !branchProtectionIndicator.statusBar)) { - return false; - } - } - + public isBranchProtected(name: string = this.HEAD?.name ?? ''): boolean { return this.isBranchProtectedMatcher ? this.isBranchProtectedMatcher(name) : false; } diff --git a/extensions/git/src/statusbar.ts b/extensions/git/src/statusbar.ts index cb178db6960..68a9c91eb3a 100644 --- a/extensions/git/src/statusbar.ts +++ b/extensions/git/src/statusbar.ts @@ -24,7 +24,7 @@ class CheckoutStatusBar { get command(): Command | undefined { const rebasing = !!this.repository.rebaseCommit; - const isBranchProtected = this.repository.isBranchProtected(undefined, 'statusBar'); + const isBranchProtected = this.repository.isBranchProtected(); const title = `${isBranchProtected ? '$(lock)' : '$(git-branch)'} ${this.repository.headLabel}${rebasing ? ` (${localize('rebasing', 'Rebasing')})` : ''}`; return {