mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 05:58:20 +00:00
Git - better validation for the branchProtection setting (#179183)
This commit is contained in:
parent
cde5bfd7a1
commit
20aee57124
1 changed files with 6 additions and 1 deletions
|
@ -2360,7 +2360,12 @@ export class Repository implements Disposable {
|
|||
|
||||
private updateBranchProtectionMatcher(): void {
|
||||
const scopedConfig = workspace.getConfiguration('git', Uri.file(this.repository.root));
|
||||
const branchProtectionGlobs = scopedConfig.get<string[]>('branchProtection')!.map(bp => bp.trim()).filter(bp => bp !== '');
|
||||
const branchProtectionConfig = scopedConfig.get<unknown>('branchProtection') ?? [];
|
||||
const branchProtectionValues = Array.isArray(branchProtectionConfig) ? branchProtectionConfig : [branchProtectionConfig];
|
||||
|
||||
const branchProtectionGlobs = branchProtectionValues
|
||||
.map(bp => typeof bp === 'string' ? bp.trim() : '')
|
||||
.filter(bp => bp !== '');
|
||||
|
||||
if (branchProtectionGlobs.length === 0) {
|
||||
this.isBranchProtectedMatcher = undefined;
|
||||
|
|
Loading…
Reference in a new issue