-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix backend forge detection for GitHub Enterprise users #13653
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 |
|---|---|---|
|
|
@@ -148,7 +148,8 @@ pub fn get_all_forge_accounts() -> anyhow::Result<Vec<ForgeUser>> { | |
| #[cfg(test)] | ||
| mod tests { | ||
| use super::{ | ||
| ForgeName, ForgeUser, match_host_to_accounts_custom_host, normalize_host_for_comparison, | ||
| ForgeName, ForgeUser, derive_forge_repo_info, match_host_to_accounts_custom_host, | ||
| normalize_host_for_comparison, | ||
| }; | ||
|
|
||
| #[test] | ||
|
|
@@ -280,4 +281,23 @@ mod tests { | |
| "repository.com" | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn derive_forge_detects_github_enterprise_subdomain_ssh() { | ||
| let info = derive_forge_repo_info("git@github.ourinternaldomain.net:our-org/my-repo.git") | ||
| .expect("should detect GHES from github.* subdomain"); | ||
| assert_eq!(info.forge, ForgeName::GitHub); | ||
| assert_eq!(info.owner, "our-org"); | ||
| assert_eq!(info.repo, "my-repo"); | ||
| } | ||
|
|
||
| #[test] | ||
| fn derive_forge_detects_github_enterprise_subdomain_https() { | ||
| let info = | ||
| derive_forge_repo_info("https://github.ourinternaldomain.net/our-org/my-repo.git") | ||
| .expect("should detect GHES from github.* subdomain"); | ||
| assert_eq!(info.forge, ForgeName::GitHub); | ||
| assert_eq!(info.owner, "our-org"); | ||
| assert_eq!(info.repo, "my-repo"); | ||
| } | ||
|
Comment on lines
+284
to
+302
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. The determination of the forge is now happening mainly in the backend, only to fallback to the frontend system if it can't catch it. So any fixes should mainly go to the rust side, if anything. I see that we're adding just extra tests (which is nice) but does the functionality need to be fixed in that case as well? |
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.