Git - Remove git.branchProtectionIndicator setting (#153020)

Remove git.branchProtectionIndicator setting
This commit is contained in:
Ladislau Szomoru
2022-06-23 21:56:54 +02:00
committed by GitHub
parent 8ae90b3feb
commit 25cc6c0dd0
5 changed files with 3 additions and 37 deletions

View File

@@ -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) { }

View File

@@ -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;
}

View File

@@ -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 {