Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub - do not clear branch protection if the user is not signed in #187588

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions extensions/github/src/branchProtection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,14 @@ export class GithubBranchProtectionProvider implements BranchProtectionProvider

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

await this.globalState.update(this.globalStateKey, undefined);
await this.globalState.update(this.globalStateKey, undefined);
}
}
}
}
Expand Down