Allow configuring custom git hosting providers in project settings (#31929)
Closes #29229 Release Notes: - Extended the support for configuring custom git hosting providers to cover project settings in addition to global settings. --------- Co-authored-by: Anthony Eid <hello@anthonyeid.me>
This commit is contained in:
parent
203754d0db
commit
1307b81721
4 changed files with 138 additions and 20 deletions
|
@ -11,6 +11,7 @@ use buffer_diff::{
|
|||
use fs::FakeFs;
|
||||
use futures::{StreamExt, future};
|
||||
use git::{
|
||||
GitHostingProviderRegistry,
|
||||
repository::RepoPath,
|
||||
status::{StatusCode, TrackedStatus},
|
||||
};
|
||||
|
@ -216,6 +217,71 @@ async fn test_editorconfig_support(cx: &mut gpui::TestAppContext) {
|
|||
});
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_git_provider_project_setting(cx: &mut gpui::TestAppContext) {
|
||||
init_test(cx);
|
||||
cx.update(|cx| {
|
||||
GitHostingProviderRegistry::default_global(cx);
|
||||
git_hosting_providers::init(cx);
|
||||
});
|
||||
|
||||
let fs = FakeFs::new(cx.executor());
|
||||
let str_path = path!("/dir");
|
||||
let path = Path::new(str_path);
|
||||
|
||||
fs.insert_tree(
|
||||
path!("/dir"),
|
||||
json!({
|
||||
".zed": {
|
||||
"settings.json": r#"{
|
||||
"git_hosting_providers": [
|
||||
{
|
||||
"provider": "gitlab",
|
||||
"base_url": "https://google.com",
|
||||
"name": "foo"
|
||||
}
|
||||
]
|
||||
}"#
|
||||
},
|
||||
}),
|
||||
)
|
||||
.await;
|
||||
|
||||
let project = Project::test(fs.clone(), [path!("/dir").as_ref()], cx).await;
|
||||
let (_worktree, _) =
|
||||
project.read_with(cx, |project, cx| project.find_worktree(path, cx).unwrap());
|
||||
cx.executor().run_until_parked();
|
||||
|
||||
cx.update(|cx| {
|
||||
let provider = GitHostingProviderRegistry::global(cx);
|
||||
assert!(
|
||||
provider
|
||||
.list_hosting_providers()
|
||||
.into_iter()
|
||||
.any(|provider| provider.name() == "foo")
|
||||
);
|
||||
});
|
||||
|
||||
fs.atomic_write(
|
||||
Path::new(path!("/dir/.zed/settings.json")).to_owned(),
|
||||
"{}".into(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
cx.run_until_parked();
|
||||
|
||||
cx.update(|cx| {
|
||||
let provider = GitHostingProviderRegistry::global(cx);
|
||||
assert!(
|
||||
!provider
|
||||
.list_hosting_providers()
|
||||
.into_iter()
|
||||
.any(|provider| provider.name() == "foo")
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_managing_project_specific_settings(cx: &mut gpui::TestAppContext) {
|
||||
init_test(cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue