environments: Don't load shell environments in non-local worktrees (#23138)
This fixes an error message that has shown up for me when joining collab projects: "Unable to load shell environment in /<path on another machine/" Release Notes: - Fixed error message about shell environment failing to load when joining projects in collaboration.
This commit is contained in:
parent
39ac6e4a75
commit
91b36c31e8
1 changed files with 12 additions and 0 deletions
|
@ -13,6 +13,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct ProjectEnvironment {
|
pub struct ProjectEnvironment {
|
||||||
|
worktree_store: Model<WorktreeStore>,
|
||||||
cli_environment: Option<HashMap<String, String>>,
|
cli_environment: Option<HashMap<String, String>>,
|
||||||
environments: HashMap<WorktreeId, Shared<Task<Option<HashMap<String, String>>>>>,
|
environments: HashMap<WorktreeId, Shared<Task<Option<HashMap<String, String>>>>>,
|
||||||
environment_error_messages: HashMap<WorktreeId, EnvironmentErrorMessage>,
|
environment_error_messages: HashMap<WorktreeId, EnvironmentErrorMessage>,
|
||||||
|
@ -33,6 +34,7 @@ impl ProjectEnvironment {
|
||||||
.detach();
|
.detach();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
worktree_store: worktree_store.clone(),
|
||||||
cli_environment,
|
cli_environment,
|
||||||
environments: Default::default(),
|
environments: Default::default(),
|
||||||
environment_error_messages: Default::default(),
|
environment_error_messages: Default::default(),
|
||||||
|
@ -102,6 +104,16 @@ impl ProjectEnvironment {
|
||||||
return Task::ready(None).shared();
|
return Task::ready(None).shared();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if self
|
||||||
|
.worktree_store
|
||||||
|
.read(cx)
|
||||||
|
.worktree_for_id(worktree_id, cx)
|
||||||
|
.map(|w| !w.read(cx).is_local())
|
||||||
|
.unwrap_or(true)
|
||||||
|
{
|
||||||
|
return Task::ready(None).shared();
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(task) = self.environments.get(&worktree_id) {
|
if let Some(task) = self.environments.get(&worktree_id) {
|
||||||
task.clone()
|
task.clone()
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue