Skip to content

Commit dca0fc0

Browse files
authored
GitHub - do not clear branch protection if the user is not signed in (microsoft#187588)
1 parent f878237 commit dca0fc0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

extensions/github/src/branchProtection.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,14 @@ export class GithubBranchProtectionProvider implements BranchProtectionProvider
204204

205205
if (err instanceof AuthenticationError) {
206206
// A GitHub authentication session could be missing if the user has not yet
207-
// signed in with their GitHub account or they have signed out. In this case
208-
// we have to clear the branch protection information.
209-
this.branchProtection = branchProtection;
210-
this._onDidChangeBranchProtection.fire(this.repository.rootUri);
207+
// signed in with their GitHub account or they have signed out. If there is
208+
// branch protection information we have to clear it.
209+
if (this.branchProtection.length !== 0) {
210+
this.branchProtection = branchProtection;
211+
this._onDidChangeBranchProtection.fire(this.repository.rootUri);
211212

212-
await this.globalState.update(this.globalStateKey, undefined);
213+
await this.globalState.update(this.globalStateKey, undefined);
214+
}
213215
}
214216
}
215217
}

0 commit comments

Comments
 (0)