Add support for self-hosted GitLab instances for Git permalinks (#19909)
This PR adds support for self-hosted GitLab instances when generating Git permalinks. If the `origin` Git remote contains `gitlab` in the URL hostname we will then attempt to register it as a self-hosted GitLab instance. A note on this: I don't think relying on specific keywords is going to be a suitable long-term solution to detection. In reality the self-hosted instance could be hosted anywhere (e.g., `vcs.my-company.com`), so we will ultimately need a way to have the user indicate which Git provider they are using (perhaps via a setting). Closes https://github.com/zed-industries/zed/issues/18012. Release Notes: - Added support for self-hosted GitLab instances when generating Git permalinks. - The instance URL must have `gitlab` somewhere in the host in order to be recognized.
This commit is contained in:
parent
3e2f1d733c
commit
322aa41ad6
7 changed files with 142 additions and 23 deletions
|
@ -111,6 +111,12 @@ impl GitHostingProviderRegistry {
|
|||
cx.global::<GlobalGitHostingProviderRegistry>().0.clone()
|
||||
}
|
||||
|
||||
/// Returns the global [`GitHostingProviderRegistry`], if one is set.
|
||||
pub fn try_global(cx: &AppContext) -> Option<Arc<Self>> {
|
||||
cx.try_global::<GlobalGitHostingProviderRegistry>()
|
||||
.map(|registry| registry.0.clone())
|
||||
}
|
||||
|
||||
/// Returns the global [`GitHostingProviderRegistry`].
|
||||
///
|
||||
/// Inserts a default [`GitHostingProviderRegistry`] if one does not yet exist.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue