From 91b36c31e8825f402c46b256fc735c94113d9588 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Tue, 14 Jan 2025 18:13:55 +0100 Subject: [PATCH] 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 /, cli_environment: Option>, environments: HashMap>>>>, environment_error_messages: HashMap, @@ -33,6 +34,7 @@ impl ProjectEnvironment { .detach(); Self { + worktree_store: worktree_store.clone(), cli_environment, environments: Default::default(), environment_error_messages: Default::default(), @@ -102,6 +104,16 @@ impl ProjectEnvironment { 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) { task.clone() } else {