diff --git a/app/src/terminal/view/tab_metadata.rs b/app/src/terminal/view/tab_metadata.rs index 0afedc85..af436f95 100644 --- a/app/src/terminal/view/tab_metadata.rs +++ b/app/src/terminal/view/tab_metadata.rs @@ -147,20 +147,46 @@ impl TerminalView { pub fn current_git_label(&self, ctx: &AppContext) -> Option { #[cfg(feature = "local_fs")] { - let repo_path = self.current_repo_path.as_ref()?; - let is_linked_worktree = repo_metadata::repositories::DetectedRepositories::as_ref(ctx) - .get_watched_repo_for_path(repo_path, ctx) - .is_some_and(|repository| { - let repository = repository.as_ref(ctx); - repository.git_dir() != repository.common_git_dir() - }); - let branch = self.current_git_branch(ctx); - Some(compute_git_label_from_repo_path( - repo_path, - branch, - is_linked_worktree, - repo_path.exists(), - )) + if let Some(repo_path) = self.current_repo_path.as_ref() { + let branch = self.current_git_branch(ctx); + // Only build the repo-path label if we actually have a branch. + // When `current_repo_path` is set by `DetectedRepositories` before + // the shell git chip has propagated, `branch` is `None` and + // `compute_git_label_from_repo_path` would return an empty + // `branch_or_sha` string. That empty string is filtered out by + // `copyable_metadata_value`, which causes the "Copy branch" context + // menu item to be absent even though the test's + // `assert_current_git_branch` guard already confirmed the chip is + // populated — a timing window that fails the vertical context menu + // metadata copy tests. Falling through to the chip path when the + // branch is unknown keeps the two readers in sync and ensures the + // menu item is present whenever the branch is known. + if branch.is_some() { + let is_linked_worktree = + repo_metadata::repositories::DetectedRepositories::as_ref(ctx) + .get_watched_repo_for_path(repo_path, ctx) + .is_some_and(|repository| { + let repository = repository.as_ref(ctx); + repository.git_dir() != repository.common_git_dir() + }); + return Some(compute_git_label_from_repo_path( + repo_path, + branch, + is_linked_worktree, + repo_path.exists(), + )); + } + } + // No detected repo path yet (or repo_path is set but branch chip has + // not yet arrived — see comment above). Fall back to the shell git chip + // so the indicator and the "Copy branch" menu item light up whenever + // the prompt exposes a branch. Matches `current_git_branch`'s own + // chip-first behavior and keeps both readers in sync. + self.current_git_branch(ctx).map(|branch| GitLabel { + worktree_slug: None, + branch_or_sha: branch, + missing: false, + }) } #[cfg(not(feature = "local_fs"))] { diff --git a/crates/integration/src/test/ssh.rs b/crates/integration/src/test/ssh.rs index 62d2245f..e737f61a 100644 --- a/crates/integration/src/test/ssh.rs +++ b/crates/integration/src/test/ssh.rs @@ -164,7 +164,11 @@ macro_rules! generate_can_bootstrap_legacy_ssh_test_for_shell { pub fn $fn_name() -> Builder { new_builder() // TODO(CORE-2333) PowerShell has no SSH wrapper. - .set_should_run_test(|| { + // Requires the GCP IAP SSH integration testing VM. Set + // CAST_CODES_SSH_INTEGRATION_TESTS=1 to opt in. + if std::env::var("CAST_CODES_SSH_INTEGRATION_TESTS").ok().as_deref() != Some("1") { + return false; + } if FeatureFlag::SSHTmuxWrapper.is_enabled() { return false; } @@ -258,7 +262,11 @@ macro_rules! generate_long_running_block_ssh_test_for_shell { pub fn $fn_name() -> Builder { new_builder() // TODO(CORE-2333) PowerShell has no SSH wrapper. - .set_should_run_test(|| { + // Requires the GCP IAP SSH integration testing VM. Set + // CAST_CODES_SSH_INTEGRATION_TESTS=1 to opt in. + if std::env::var("CAST_CODES_SSH_INTEGRATION_TESTS").ok().as_deref() != Some("1") { + return false; + } let (starter, _) = current_shell_starter_and_version(); starter.shell_type() != ShellType::PowerShell }) @@ -306,7 +314,12 @@ generate_long_running_block_ssh_test_for_shell!(test_ssh_into_ash, "ash", prompt pub fn test_ssh_with_shell_override() -> Builder { new_builder() // TODO(CORE-2333) PowerShell has no SSH wrapper. + // Requires the GCP IAP SSH integration testing VM. Set + // CAST_CODES_SSH_INTEGRATION_TESTS=1 to opt in. .set_should_run_test(|| { + if std::env::var("CAST_CODES_SSH_INTEGRATION_TESTS").ok().as_deref() != Some("1") { + return false; + } let (starter, _) = current_shell_starter_and_version(); starter.shell_type() != ShellType::PowerShell })