-
Notifications
You must be signed in to change notification settings - Fork 1k
Revert "Fix backend forge detection for GitHub Enterprise users" #13705
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| import { AzureDevOps } from "$lib/forge/azure/azure"; | ||
| import { BitBucket } from "$lib/forge/bitbucket/bitbucket"; | ||
| import { AZURE_DOMAIN, AzureDevOps } from "$lib/forge/azure/azure"; | ||
| import { BitBucket, BITBUCKET_DOMAIN } from "$lib/forge/bitbucket/bitbucket"; | ||
| import { DefaultForge } from "$lib/forge/default/default"; | ||
| import { GitHub } from "$lib/forge/github/github"; | ||
| import { GitHub, GITHUB_DOMAIN } from "$lib/forge/github/github"; | ||
| import { GitHubClient } from "$lib/forge/github/githubClient"; | ||
| import { GitLab } from "$lib/forge/gitlab/gitlab"; | ||
| import { GitLab, GITLAB_DOMAIN, GITLAB_SUB_DOMAIN } from "$lib/forge/gitlab/gitlab"; | ||
| import { InjectionToken } from "@gitbutler/core/context"; | ||
| import { deepCompare } from "@gitbutler/shared/compare"; | ||
| import type { ForgeProvider } from "$lib/baseBranch/baseBranch"; | ||
|
|
@@ -113,16 +113,16 @@ export class DefaultForgeFactory implements Reactive<Forge> { | |
| } = config; | ||
| this._githubError = githubError; | ||
| if (repo && baseBranch) { | ||
| const forgeType = forgeOverride ?? detectedForgeProvider ?? "default"; | ||
| this._determinedForgeType = forgeType; | ||
| this._determinedForgeType = this.determineForgeType(repo, detectedForgeProvider); | ||
| this._forge = this.build({ | ||
| repo, | ||
| pushRepo, | ||
| baseBranch, | ||
| forgeType, | ||
| githubAuthenticated, | ||
| forgeIsLoading, | ||
| gitlabAuthenticated, | ||
| detectedForgeProvider, | ||
| forgeOverride, | ||
| }); | ||
|
Comment on lines
115
to
126
|
||
| } else { | ||
| this._determinedForgeType = "default"; | ||
|
|
@@ -134,19 +134,25 @@ export class DefaultForgeFactory implements Reactive<Forge> { | |
| repo, | ||
| pushRepo, | ||
| baseBranch, | ||
| forgeType, | ||
| githubAuthenticated, | ||
| forgeIsLoading, | ||
| gitlabAuthenticated, | ||
| detectedForgeProvider, | ||
| forgeOverride, | ||
| }: { | ||
| repo: RepoInfo; | ||
| pushRepo?: RepoInfo; | ||
| baseBranch: string; | ||
| forgeType: ForgeName; | ||
| githubAuthenticated?: boolean; | ||
| forgeIsLoading?: boolean; | ||
| gitlabAuthenticated?: boolean; | ||
| detectedForgeProvider: ForgeProvider | undefined; | ||
| forgeOverride: ForgeName | undefined; | ||
| }): Forge { | ||
| let forgeType = this.determineForgeType(repo, detectedForgeProvider); | ||
| if (forgeType === "default" && forgeOverride) { | ||
| forgeType = forgeOverride; | ||
|
Comment on lines
+153
to
+154
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Apply Useful? React with 👍 / 👎. |
||
| } | ||
|
Comment on lines
+152
to
+155
|
||
| const forkStr = | ||
| pushRepo && pushRepo.hash !== repo.hash ? `${pushRepo.owner}:${pushRepo.name}` : undefined; | ||
|
|
||
|
|
@@ -192,6 +198,35 @@ export class DefaultForgeFactory implements Reactive<Forge> { | |
| return this.default; | ||
| } | ||
|
|
||
| private determineForgeType( | ||
| repo: RepoInfo, | ||
| detectedForgeProvider: ForgeProvider | undefined, | ||
| ): ForgeName { | ||
| if (detectedForgeProvider) { | ||
| return detectedForgeProvider; | ||
| } | ||
| const domain = repo.domain; | ||
|
|
||
| if (domain.includes(GITHUB_DOMAIN)) { | ||
| return "github"; | ||
| } | ||
| if ( | ||
| domain === GITLAB_DOMAIN || | ||
| domain.startsWith(GITLAB_SUB_DOMAIN + ".") || | ||
| domain.startsWith("xy" + GITLAB_SUB_DOMAIN + ".") // Temporary workaround until we have foerge overrides implemented | ||
|
|
||
| ) { | ||
|
Comment on lines
+213
to
+217
|
||
| return "gitlab"; | ||
| } | ||
| if (domain.includes(BITBUCKET_DOMAIN)) { | ||
| return "bitbucket"; | ||
| } | ||
| if (domain.includes(AZURE_DOMAIN)) { | ||
| return "azure"; | ||
|
Comment on lines
+208
to
+224
|
||
| } | ||
|
|
||
| return "default"; | ||
| } | ||
|
|
||
| invalidate(tags: TagDescription<ReduxTag>[]) { | ||
| const action = this.current.invalidate(tags); | ||
| const { dispatch } = this.params; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
determinedForgeTypeis set fromdetermineForgeType(...)without consideringforgeOverride, butbuild()can still switch to an override when detection returnsdefault. In that case state becomes inconsistent (currentis GitHub/GitLab whiledeterminedForgeTypestaysdefault), which suppresses integration UI paths that gate ondeterminedForgeType !== "default"(e.g. the forge integration banner).Useful? React with 👍 / 👎.