Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
feat(switch): display PR/MR context when checking out (#782)
Maximilian Roos77afa41160b1
diff --git a/src/commands/worktree/switch.rs b/src/commands/worktree/switch.rsindex 9792950e7..df3660c41 100644--- a/src/commands/worktree/switch.rs+++ b/src/commands/worktree/switch.rs@@ -10,9 +10,10 @@ use dunce::canonicalize;use worktrunk::config::UserConfig;use worktrunk::git::mr_ref;use worktrunk::git::pr_ref::{self, fork_remote_url, prefixed_local_branch_name};-use worktrunk::git::{GitError, RefType, Repository};+use worktrunk::git::{GitError, RefContext, RefType, Repository};use worktrunk::styling::{- hint_message, info_message, progress_message, suggest_command, warning_message,+ format_with_gutter, hint_message, info_message, progress_message, suggest_command,+ warning_message,};use super::resolve::{compute_clobber_backup, compute_worktree_path, paths_match};@@ -27,6 +28,29 @@ struct ResolvedTarget {method: CreationMethod,}+/// Format PR/MR context for gutter display after fetching.+///+/// Returns two lines for gutter formatting:+/// ```text+/// ┃ Fix authentication bug in login flow (#101)+/// ┃ by @alice · open · https://github.com/owner/repo/pull/101+/// ```+fn format_ref_context(ctx: &impl RefContext) -> String {+ let mut status_parts = vec![format!("by @{}", ctx.author()), ctx.state().to_string()];+ if ctx.draft() {+ status_parts.push("draft".to_string());+ }+ let status_line = status_parts.join(" · ");++ cformat!(+ "<bold>{}</> ({}{})\n{status_line} · <bright-black>{}</>",+ ctx.title(),+ ctx.ref_type().symbol(),+ ctx.number(),+ ctx.url()+ )+}+/// Resolve a PR reference (`pr:<number>` syntax).fn resolve_pr_ref(repo: &Repository,@@ -56,6 +80,9 @@ fn resolve_pr_ref(let repo_root = repo.repo_path();let pr_info = pr_ref::fetch_pr_info(pr_number, repo_root)?;+ // Display PR context with URL (as gutter under fetch progress)+ crate::output::print(format_with_gutter(&format_ref_context(&pr_info), None))?;+if pr_info.is_cross_repository {// Fork PR: check if branch already exists and is tracking this PRlet local_branch = pr_ref::local_branch_name(&pr_info);@@ -198,6 +225,9 @@ fn resolve_mr_ref(let repo_root = repo.repo_path();let mr_info = mr_ref::fetch_mr_info(mr_number, repo_root)?;+ // Display MR context with URL (as gutter under fetch progress)+ crate::output::print(format_with_gutter(&format_ref_context(&mr_info), None))?;+if mr_info.is_cross_project {// Fork MR: check if branch already exists and is tracking this MRlet local_branch = mr_ref::local_branch_name(&mr_info);@@ -607,7 +637,7 @@ pub fn execute_switch(let result = if already_at_worktree {SwitchResult::AlreadyAt(path)} else {- SwitchResult::Existing(path)+ SwitchResult::Existing { path }};Ok((diff --git a/src/commands/worktree/types.rs b/src/commands/worktree/types.rsindex 1653b707c..be9f7ef72 100644--- a/src/commands/worktree/types.rs+++ b/src/commands/worktree/types.rs@@ -19,7 +19,7 @@ pub enum SwitchResult {/// Already at the target worktree (no action taken)AlreadyAt(PathBuf),/// Switched to existing worktree at the given path- Existing(PathBuf),+ Existing { path: PathBuf },/// Created new worktree at the given pathCreated {path: PathBuf,@@ -40,7 +40,7 @@ impl SwitchResult {pub fn path(&self) -> &PathBuf {match self {SwitchResult::AlreadyAt(path) => path,- SwitchResult::Existing(path) => path,+ SwitchResult::Existing { path, .. } => path,SwitchResult::Created { path, .. } => path,}}@@ -238,7 +238,7 @@ mod tests {#[test]fn test_switch_result_path_existing() {let path = PathBuf::from("/test/existing");- let result = SwitchResult::Existing(path.clone());+ let result = SwitchResult::Existing { path: path.clone() };assert_eq!(result.path(), &path);}diff --git a/src/git/error.rs b/src/git/error.rsindex 17b59f37f..a65c2524b 100644--- a/src/git/error.rs+++ b/src/git/error.rs@@ -74,6 +74,19 @@ impl RefType {}}+/// Common display fields for PR/MR context.+///+/// Implemented by both `PrInfo` and `MrInfo` to enable unified formatting.+pub trait RefContext {+ fn ref_type(&self) -> RefType;+ fn number(&self) -> u32;+ fn title(&self) -> &str;+ fn author(&self) -> &str;+ fn state(&self) -> &str;+ fn draft(&self) -> bool;+ fn url(&self) -> &str;+}+/// Domain errors for git and worktree operations.////// This enum provides structured error data that can be pattern-matched and tested.diff --git a/src/git/mod.rs b/src/git/mod.rsindex 6ac82b81d..ca6a2ef79 100644--- a/src/git/mod.rs+++ b/src/git/mod.rs@@ -40,6 +40,7 @@ pub use error::{// Special-handling error enum (Display produces styled output)HookErrorWithHint,// Platform-specific reference type (PR vs MR)+ RefContext,RefType,WorktrunkError,// Error inspection functionsdiff --git a/src/git/mr_ref.rs b/src/git/mr_ref.rsindex 3cfa948d8..8e57f1ab0 100644--- a/src/git/mr_ref.rs+++ b/src/git/mr_ref.rs@@ -32,6 +32,14 @@ use crate::shell_exec::Cmd;pub struct MrInfo {/// The MR number (iid in GitLab terms).pub number: u32,+ /// The MR title.+ pub title: String,+ /// The MR author's username.+ pub author: String,+ /// The MR state ("opened", "closed", "merged").+ pub state: String,+ /// Whether this is a draft/WIP MR.+ pub draft: bool,/// The branch name in the source project.pub source_branch: String,/// The source project ID.@@ -52,9 +60,38 @@ pub struct MrInfo {pub url: String,}+impl super::RefContext for MrInfo {+ fn ref_type(&self) -> super::RefType {+ super::RefType::Mr+ }+ fn number(&self) -> u32 {+ self.number+ }+ fn title(&self) -> &str {+ &self.title+ }+ fn author(&self) -> &str {+ &self.author+ }+ fn state(&self) -> &str {+ &self.state+ }+ fn draft(&self) -> bool {+ self.draft+ }+ fn url(&self) -> &str {+ &self.url+ }+}+/// Raw JSON response from `glab mr view <number> --output json`.#[derive(Debug, Deserialize)]struct GlabMrResponse {+ title: String,+ author: GlabAuthor,+ state: String,+ #[serde(default)]+ draft: bool,source_branch: String,source_project_id: u64,target_project_id: u64,@@ -67,6 +104,11 @@ struct GlabMrResponse {target_project: Option<GlabProject>,}+#[derive(Debug, Deserialize)]+struct GlabAuthor {+ username: String,+}+#[derive(Debug, Deserialize)]struct GlabProject {ssh_url_to_repo: Option<String>,@@ -168,6 +210,10 @@ pub fn fetch_mr_info(mr_number: u32, repo_root: &std::path::Path) -> anyhow::ResOk(MrInfo {number: mr_number,+ title: response.title,+ author: response.author.username,+ state: response.state,+ draft: response.draft,source_branch: response.source_branch,source_project_id: response.source_project_id,target_project_id: response.target_project_id,@@ -291,6 +337,10 @@ mod tests {fn test_local_branch_name() {let mr = MrInfo {number: 101,+ title: "Fix authentication bug".to_string(),+ author: "alice".to_string(),+ state: "opened".to_string(),+ draft: false,source_branch: "feature-auth".to_string(),source_project_id: 123,target_project_id: 123,@@ -310,6 +360,10 @@ mod tests {// the local branch name must match the fork's branch for git push to worklet mr = MrInfo {number: 101,+ title: "Fix authentication bug".to_string(),+ author: "contributor".to_string(),+ state: "opened".to_string(),+ draft: false,source_branch: "feature-auth".to_string(),source_project_id: 456,target_project_id: 123,@@ -327,6 +381,10 @@ mod tests {fn test_fork_remote_url_with_both_urls() {let mr = MrInfo {number: 101,+ title: "Feature".to_string(),+ author: "contributor".to_string(),+ state: "opened".to_string(),+ draft: false,source_branch: "feature".to_string(),source_project_id: 456,target_project_id: 123,@@ -353,6 +411,10 @@ mod tests {fn test_fork_remote_url_ssh_only() {let mr = MrInfo {number: 101,+ title: "Feature".to_string(),+ author: "contributor".to_string(),+ state: "opened".to_string(),+ draft: false,source_branch: "feature".to_string(),source_project_id: 456,target_project_id: 123,@@ -373,6 +435,10 @@ mod tests {fn test_fork_remote_url_https_only() {let mr = MrInfo {number: 101,+ title: "Feature".to_string(),+ author: "contributor".to_string(),+ state: "opened".to_string(),+ draft: false,source_branch: "feature".to_string(),source_project_id: 456,target_project_id: 123,@@ -396,6 +462,10 @@ mod tests {fn test_fork_remote_url_none() {let mr = MrInfo {number: 101,+ title: "Feature".to_string(),+ author: "contributor".to_string(),+ state: "opened".to_string(),+ draft: false,source_branch: "feature".to_string(),source_project_id: 456,target_project_id: 123,@@ -416,6 +486,10 @@ mod tests {fn test_target_remote_url_with_both_urls() {let mr = MrInfo {number: 101,+ title: "Feature".to_string(),+ author: "contributor".to_string(),+ state: "opened".to_string(),+ draft: false,source_branch: "feature".to_string(),source_project_id: 456,target_project_id: 123,@@ -442,6 +516,10 @@ mod tests {fn test_target_remote_url_none() {let mr = MrInfo {number: 101,+ title: "Feature".to_string(),+ author: "contributor".to_string(),+ state: "opened".to_string(),+ draft: false,source_branch: "feature".to_string(),source_project_id: 456,target_project_id: 123,diff --git a/src/git/pr_ref.rs b/src/git/pr_ref.rsindex 60684fbee..5f77bfce0 100644--- a/src/git/pr_ref.rs+++ b/src/git/pr_ref.rs@@ -41,6 +41,14 @@ use crate::shell_exec::Cmd;pub struct PrInfo {/// The PR number.pub number: u32,+ /// The PR title.+ pub title: String,+ /// The PR author's username.+ pub author: String,+ /// The PR state ("open", "closed").+ pub state: String,+ /// Whether this is a draft PR.+ pub draft: bool,/// The branch name in the head repository.pub head_ref_name: String,/// The owner of the head repository (fork owner for cross-repo PRs).@@ -59,14 +67,48 @@ pub struct PrInfo {pub url: String,}+impl super::RefContext for PrInfo {+ fn ref_type(&self) -> super::RefType {+ super::RefType::Pr+ }+ fn number(&self) -> u32 {+ self.number+ }+ fn title(&self) -> &str {+ &self.title+ }+ fn author(&self) -> &str {+ &self.author+ }+ fn state(&self) -> &str {+ &self.state+ }+ fn draft(&self) -> bool {+ self.draft+ }+ fn url(&self) -> &str {+ &self.url+ }+}+/// Raw JSON response from `gh api repos/{owner}/{repo}/pulls/{number}`.#[derive(Debug, Deserialize)]struct GhApiPrResponse {+ title: String,+ user: GhUser,+ state: String,+ #[serde(default)]+ draft: bool,head: GhPrRef,base: GhPrRef,html_url: String,}+#[derive(Debug, Deserialize)]+struct GhUser {+ login: String,+}+#[derive(Debug, Deserialize)]struct GhPrRef {#[serde(rename = "ref")]@@ -219,6 +261,10 @@ pub fn fetch_pr_info(pr_number: u32, repo_root: &std::path::Path) -> anyhow::ResOk(PrInfo {number: pr_number,+ title: response.title,+ author: response.user.login,+ state: response.state,+ draft: response.draft,head_ref_name: response.head.ref_name,head_owner: head_repo.owner.login,head_repo: head_repo.name,@@ -319,6 +365,10 @@ mod tests {fn test_local_branch_name_same_repo() {let pr = PrInfo {number: 101,+ title: "Fix authentication bug".to_string(),+ author: "alice".to_string(),+ state: "open".to_string(),+ draft: false,head_ref_name: "feature-auth".to_string(),head_owner: "owner".to_string(),head_repo: "repo".to_string(),@@ -337,6 +387,10 @@ mod tests {// the local branch name must match the fork's branch for git push to worklet pr = PrInfo {number: 101,+ title: "Fix authentication bug".to_string(),+ author: "contributor".to_string(),+ state: "open".to_string(),+ draft: false,head_ref_name: "feature-auth".to_string(),head_owner: "contributor".to_string(),head_repo: "repo".to_string(),@@ -363,6 +417,10 @@ mod tests {is_cross_repository: true,host: "github.com".to_string(),url: "https://github.com/owner/repo/pull/101".to_string(),+ title: "Test PR".to_string(),+ author: "contributor".to_string(),+ state: "open".to_string(),+ draft: false,};assert_eq!(prefixed_local_branch_name(&pr), "contributor/main");}diff --git a/src/main.rs b/src/main.rsindex f05f0b4b8..7c6f5d571 100644--- a/src/main.rs+++ b/src/main.rs@@ -797,7 +797,7 @@ fn main() {base_worktree_path,..} => (base_branch.as_deref(), base_worktree_path.as_deref()),- SwitchResult::Existing(_) | SwitchResult::AlreadyAt(_) => (None, None),+ SwitchResult::Existing { .. } | SwitchResult::AlreadyAt(_) => (None, None),};let extra_vars: Vec<(&str, &str)> = [base_branch.map(|b| ("base", b)),diff --git a/src/output/handlers.rs b/src/output/handlers.rsindex 49f53bfbe..27e17626b 100644--- a/src/output/handlers.rs+++ b/src/output/handlers.rs@@ -338,7 +338,7 @@ pub fn handle_switch_output(// User is already there - no path annotation neededNone}- SwitchResult::Existing(_) => {+ SwitchResult::Existing { .. } => {if let Some(reason) = &shell_warning_reason {// Shell integration not active — single warning with contextif let Some(warning) = branch_worktree_mismatch_warning {diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rsindex 940cf935a..ab1310ec0 100644--- a/tests/integration_tests/switch.rs+++ b/tests/integration_tests/switch.rs@@ -1463,6 +1463,10 @@ fn test_switch_pr_same_repo(#[from(repo_with_remote)] mut repo: TestRepo) {// gh api repos/{owner}/{repo}/pulls/{number} formatlet gh_response = r#"{+ "title": "Fix authentication bug in login flow",+ "user": {"login": "alice"},+ "state": "open",+ "draft": false,"head": {"ref": "feature-auth","repo": {"name": "test-repo", "owner": {"login": "owner"}}@@ -1504,6 +1508,10 @@ fn test_switch_pr_same_repo_no_remote(#[from(repo_with_remote)] repo: TestRepo)// but origin points to contributor/test-repo (different repo)// So find_remote_for_repo("owner", "test-repo") will faillet gh_response = r#"{+ "title": "Fix authentication bug in login flow",+ "user": {"login": "alice"},+ "state": "open",+ "draft": false,"head": {"ref": "feature-auth","repo": {"name": "test-repo", "owner": {"login": "owner"}}@@ -1585,6 +1593,10 @@ fn test_switch_pr_fork(#[from(repo_with_remote)] repo: TestRepo) {// gh api repos/{owner}/{repo}/pulls/{number} format// head.repo is the fork (contributor/test-repo), base.repo is the upstream (owner/test-repo)let gh_response = r#"{+ "title": "Add feature fix for edge case",+ "user": {"login": "contributor"},+ "state": "open",+ "draft": false,"head": {"ref": "feature-fix","repo": {"name": "test-repo", "owner": {"login": "contributor"}}@@ -1627,6 +1639,10 @@ fn test_switch_pr_fork_no_upstream_remote(#[from(repo_with_remote)] repo: TestRe// but origin points to contributor/test-repo (the fork)// So find_remote_for_repo("owner", "test-repo") will faillet gh_response = r#"{+ "title": "Add feature fix for edge case",+ "user": {"login": "contributor"},+ "state": "open",+ "draft": false,"head": {"ref": "feature-fix","repo": {"name": "test-repo", "owner": {"login": "contributor"}}@@ -1681,6 +1697,10 @@ fn test_switch_pr_deleted_fork(#[from(repo_with_remote)] repo: TestRepo) {// gh api repos/{owner}/{repo}/pulls/{number} format with null head.repo// This happens when the fork that the PR was opened from has been deletedlet gh_response = r#"{+ "title": "Add feature fix for edge case",+ "user": {"login": "contributor"},+ "state": "open",+ "draft": false,"head": {"ref": "feature-fix","repo": null@@ -1732,6 +1752,10 @@ fn test_switch_pr_fork_existing_same_pr(#[from(repo_with_remote)] repo: TestRepo// gh api repos/{owner}/{repo}/pulls/{number} formatlet gh_response = r#"{+ "title": "Add feature fix for edge case",+ "user": {"login": "contributor"},+ "state": "open",+ "draft": false,"head": {"ref": "feature-fix","repo": {"name": "test-repo", "owner": {"login": "contributor"}}@@ -1812,6 +1836,10 @@ fn test_switch_pr_fork_existing_different_pr(#[from(repo_with_remote)] repo: Tes// gh api repos/{owner}/{repo}/pulls/{number} formatlet gh_response = r#"{+ "title": "Add feature fix for edge case",+ "user": {"login": "contributor"},+ "state": "open",+ "draft": false,"head": {"ref": "feature-fix","repo": {"name": "test-repo", "owner": {"login": "contributor"}}@@ -1883,6 +1911,10 @@ fn test_switch_pr_fork_existing_no_tracking(#[from(repo_with_remote)] repo: Test// gh api repos/{owner}/{repo}/pulls/{number} formatlet gh_response = r#"{+ "title": "Add feature fix for edge case",+ "user": {"login": "contributor"},+ "state": "open",+ "draft": false,"head": {"ref": "feature-fix","repo": {"name": "test-repo", "owner": {"login": "contributor"}}@@ -1963,6 +1995,10 @@ fn test_switch_pr_fork_prefixed_exists_same_pr(#[from(repo_with_remote)] repo: T]);let gh_response = r#"{+ "title": "Add feature fix for edge case",+ "user": {"login": "contributor"},+ "state": "open",+ "draft": false,"head": {"ref": "feature-fix","repo": {"name": "test-repo", "owner": {"login": "contributor"}}@@ -2028,6 +2064,10 @@ fn test_switch_pr_fork_prefixed_exists_different_pr(#[from(repo_with_remote)] re]);let gh_response = r#"{+ "title": "Add feature fix for edge case",+ "user": {"login": "contributor"},+ "state": "open",+ "draft": false,"head": {"ref": "feature-fix","repo": {"name": "test-repo", "owner": {"login": "contributor"}}@@ -2191,6 +2231,10 @@ fn test_switch_pr_empty_branch(#[from(repo_with_remote)] repo: TestRepo) {// Configure gh to return valid JSON but with empty branch name (head.ref is "")let gh_response = r#"{+ "title": "PR with empty branch",+ "user": {"login": "contributor"},+ "state": "open",+ "draft": false,"head": {"ref": "","repo": {"name": "test-repo", "owner": {"login": "contributor"}}@@ -2298,6 +2342,10 @@ fn test_switch_mr_same_repo(#[from(repo_with_remote)] mut repo: TestRepo) {// glab mr view <number> --output json formatlet glab_response = r#"{+ "title": "Fix authentication bug in login flow",+ "author": {"username": "alice"},+ "state": "opened",+ "draft": false,"source_branch": "feature-auth","source_project_id": 123,"target_project_id": 123,@@ -2406,6 +2454,10 @@ fn test_switch_mr_empty_branch(#[from(repo_with_remote)] repo: TestRepo) {// Configure glab to return valid JSON but with empty branch namelet glab_response = r#"{+ "title": "MR with empty branch",+ "author": {"username": "contributor"},+ "state": "opened",+ "draft": false,"source_branch": "","source_project_id": 456,"target_project_id": 123,@@ -2490,6 +2542,10 @@ fn test_switch_mr_fork(#[from(repo_with_remote)] repo: TestRepo) {// glab mr view <number> --output json format// source_project is the fork (contributor/test-repo), target_project is the upstream (owner/test-repo)let glab_response = r#"{+ "title": "Add feature fix for edge case",+ "author": {"username": "contributor"},+ "state": "opened",+ "draft": false,"source_branch": "feature-fix","source_project_id": 456,"target_project_id": 123,@@ -2576,6 +2632,10 @@ fn test_switch_mr_fork_existing_branch_tracks_mr(#[from(repo_with_remote)] repo:// Fork MR responselet glab_response = r#"{+ "title": "Add feature fix for edge case",+ "author": {"username": "contributor"},+ "state": "opened",+ "draft": false,"source_branch": "feature-fix","source_project_id": 456,"target_project_id": 123,@@ -2630,6 +2690,10 @@ fn test_switch_mr_fork_existing_branch_tracks_different(#[from(repo_with_remote)// Fork MR response for MR 42, but branch tracks MR 99let glab_response = r#"{+ "title": "Add feature fix for edge case",+ "author": {"username": "contributor"},+ "state": "opened",+ "draft": false,"source_branch": "feature-fix","source_project_id": 456,"target_project_id": 123,@@ -2671,6 +2735,10 @@ fn test_switch_mr_fork_existing_no_tracking(#[from(repo_with_remote)] repo: Test// Fork MR responselet glab_response = r#"{+ "title": "Add feature fix for edge case",+ "author": {"username": "contributor"},+ "state": "opened",+ "draft": false,"source_branch": "feature-fix","source_project_id": 456,"target_project_id": 123,diff --git a/tests/snapshots/integration__integration_tests__switch__switch_mr_fork.snap b/tests/snapshots/integration__integration_tests__switch__switch_mr_fork.snapindex 210897bf4..12354bc19 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_mr_fork.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_mr_fork.snap@@ -36,6 +36,8 @@ exit_code: 0----- stderr -----[36m◎[39m [36mFetching MR !42...[39m+[107m [0m [1mAdd feature fix for edge case[22m (!42)+[107m [0m by @contributor · opened · [90mhttps://gitlab.com/owner/test-repo/-/merge_requests/42[39m[2m○[22m Push configured to fork: [90mhttps://gitlab.com/contributor/test-repo.git[39m[32m✓[39m [32mCreated branch [1mfeature-fix[22m (tracking [1mMR !42[22m) and worktree @ [1m_REPO_.feature-fix[22m[39m[33m▲[39m [33mCannot change directory — shell integration not installed[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_mr_fork_existing_branch_tracks_different.snap b/tests/snapshots/integration__integration_tests__switch__switch_mr_fork_existing_branch_tracks_different.snapindex 307e04933..ff7799e69 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_mr_fork_existing_branch_tracks_different.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_mr_fork_existing_branch_tracks_different.snap@@ -36,5 +36,7 @@ exit_code: 1----- stderr -----[36m◎[39m [36mFetching MR !42...[39m+[107m [0m [1mAdd feature fix for edge case[22m (!42)+[107m [0m by @contributor · opened · [90mhttps://gitlab.com/owner/test-repo/-/merge_requests/42[39m[31m✗[39m [31mBranch [1mfeature-fix[22m exists but doesn't track MR !42[39m[2m↳[22m [2mTo free the name, run [90mgit branch -m -- feature-fix feature-fix-old[39m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_mr_fork_existing_branch_tracks_mr.snap b/tests/snapshots/integration__integration_tests__switch__switch_mr_fork_existing_branch_tracks_mr.snapindex cfbf30dea..5c1573e4d 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_mr_fork_existing_branch_tracks_mr.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_mr_fork_existing_branch_tracks_mr.snap@@ -36,6 +36,8 @@ exit_code: 0----- stderr -----[36m◎[39m [36mFetching MR !42...[39m+[107m [0m [1mAdd feature fix for edge case[22m (!42)+[107m [0m by @contributor · opened · [90mhttps://gitlab.com/owner/test-repo/-/merge_requests/42[39m[2m○[22m Branch [1mfeature-fix[22m already configured for MR !42[32m✓[39m [32mCreated worktree for [1mfeature-fix[22m @ [1m_REPO_.feature-fix[22m[39m[33m▲[39m [33mCannot change directory — shell integration not installed[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_mr_fork_existing_no_tracking.snap b/tests/snapshots/integration__integration_tests__switch__switch_mr_fork_existing_no_tracking.snapindex 307e04933..ff7799e69 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_mr_fork_existing_no_tracking.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_mr_fork_existing_no_tracking.snap@@ -36,5 +36,7 @@ exit_code: 1----- stderr -----[36m◎[39m [36mFetching MR !42...[39m+[107m [0m [1mAdd feature fix for edge case[22m (!42)+[107m [0m by @contributor · opened · [90mhttps://gitlab.com/owner/test-repo/-/merge_requests/42[39m[31m✗[39m [31mBranch [1mfeature-fix[22m exists but doesn't track MR !42[39m[2m↳[22m [2mTo free the name, run [90mgit branch -m -- feature-fix feature-fix-old[39m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_mr_same_repo.snap b/tests/snapshots/integration__integration_tests__switch__switch_mr_same_repo.snapindex df27961fa..ceb53e4a3 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_mr_same_repo.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_mr_same_repo.snap@@ -36,5 +36,7 @@ exit_code: 0----- stderr -----[36m◎[39m [36mFetching MR !101...[39m+[107m [0m [1mFix authentication bug in login flow[22m (!101)+[107m [0m by @alice · opened · [90mhttps://gitlab.com/owner/test-repo/-/merge_requests/101[39m[33m▲[39m [33mWorktree for [1mfeature-auth[22m @ [1m_REPO_.feature-auth[22m, but cannot change directory — shell integration not installed[39m[2m↳[22m [2mTo enable automatic cd, run [90mwt config shell install[39m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork.snapindex c75fb10a4..30a112bc1 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork.snap@@ -36,6 +36,8 @@ exit_code: 0----- stderr -----[36m◎[39m [36mFetching PR #42...[39m+[107m [0m [1mAdd feature fix for edge case[22m (#42)+[107m [0m by @contributor · open · [90mhttps://github.com/owner/test-repo/pull/42[39m[2m○[22m Push configured to fork: [90mhttps://github.com/contributor/test-repo.git[39m[32m✓[39m [32mCreated branch [1mfeature-fix[22m (tracking [1mPR #42[22m) and worktree @ [1m_REPO_.feature-fix[22m[39m[33m▲[39m [33mCannot change directory — shell integration not installed[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_different_pr.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_different_pr.snapindex 55d435831..798ded677 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_different_pr.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_different_pr.snap@@ -36,6 +36,8 @@ exit_code: 0----- stderr -----[36m◎[39m [36mFetching PR #42...[39m+[107m [0m [1mAdd feature fix for edge case[22m (#42)+[107m [0m by @contributor · open · [90mhttps://github.com/owner/test-repo/pull/42[39m[33m▲[39m [33mUsing prefixed branch name [1mcontributor/feature-fix[22m due to name conflict[39m[2m↳[22m [2mPush to fork is not supported with prefixed branches; feedback welcome at https://github.com/max-sixty/worktrunk/issues/714[22m[32m✓[39m [32mCreated branch [1mcontributor/feature-fix[22m (tracking [1mPR #42[22m) and worktree @ [1m_REPO_.contributor-feature-fix[22m[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_no_tracking.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_no_tracking.snapindex 55d435831..798ded677 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_no_tracking.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_no_tracking.snap@@ -36,6 +36,8 @@ exit_code: 0----- stderr -----[36m◎[39m [36mFetching PR #42...[39m+[107m [0m [1mAdd feature fix for edge case[22m (#42)+[107m [0m by @contributor · open · [90mhttps://github.com/owner/test-repo/pull/42[39m[33m▲[39m [33mUsing prefixed branch name [1mcontributor/feature-fix[22m due to name conflict[39m[2m↳[22m [2mPush to fork is not supported with prefixed branches; feedback welcome at https://github.com/max-sixty/worktrunk/issues/714[22m[32m✓[39m [32mCreated branch [1mcontributor/feature-fix[22m (tracking [1mPR #42[22m) and worktree @ [1m_REPO_.contributor-feature-fix[22m[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_same_pr.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_same_pr.snapindex f2065a48d..bd7588022 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_same_pr.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_same_pr.snap@@ -36,6 +36,8 @@ exit_code: 0----- stderr -----[36m◎[39m [36mFetching PR #42...[39m+[107m [0m [1mAdd feature fix for edge case[22m (#42)+[107m [0m by @contributor · open · [90mhttps://github.com/owner/test-repo/pull/42[39m[2m○[22m Branch [1mfeature-fix[22m already configured for PR #42[32m✓[39m [32mCreated worktree for [1mfeature-fix[22m @ [1m_REPO_.feature-fix[22m[39m[33m▲[39m [33mCannot change directory — shell integration not installed[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_no_upstream.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_no_upstream.snapindex e463cf2b8..df718c37d 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_no_upstream.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_no_upstream.snap@@ -36,5 +36,7 @@ exit_code: 1----- stderr -----[36m◎[39m [36mFetching PR #42...[39m+[107m [0m [1mAdd feature fix for edge case[22m (#42)+[107m [0m by @contributor · open · [90mhttps://github.com/owner/test-repo/pull/42[39m[31m✗[39m [31mNo remote found for [1mowner/test-repo[22m[39m[2m↳[22m [2mAdd the remote: [90mgit remote add upstream https://github.com/owner/test-repo.git[39m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_prefixed_exists_different_pr.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_prefixed_exists_different_pr.snapindex e7f47701b..889c12ebf 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_prefixed_exists_different_pr.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_prefixed_exists_different_pr.snap@@ -36,5 +36,7 @@ exit_code: 1----- stderr -----[36m◎[39m [36mFetching PR #42...[39m+[107m [0m [1mAdd feature fix for edge case[22m (#42)+[107m [0m by @contributor · open · [90mhttps://github.com/owner/test-repo/pull/42[39m[31m✗[39m [31mBranch [1mcontributor/feature-fix[22m exists but doesn't track PR #42[39m[2m↳[22m [2mTo free the name, run [90mgit branch -m -- contributor/feature-fix contributor/feature-fix-old[39m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_prefixed_exists_same_pr.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_prefixed_exists_same_pr.snapindex 18236f548..21dfb4528 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_prefixed_exists_same_pr.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_fork_prefixed_exists_same_pr.snap@@ -36,6 +36,8 @@ exit_code: 0----- stderr -----[36m◎[39m [36mFetching PR #42...[39m+[107m [0m [1mAdd feature fix for edge case[22m (#42)+[107m [0m by @contributor · open · [90mhttps://github.com/owner/test-repo/pull/42[39m[2m○[22m Branch [1mcontributor/feature-fix[22m already configured for PR #42[33m▲[39m [33mWorktree for [1mcontributor/feature-fix[22m @ [1m_REPO_.contributor-feature-fix[22m, but cannot change directory — shell integration not installed[39m[2m↳[22m [2mTo enable automatic cd, run [90mwt config shell install[39m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_same_repo.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_same_repo.snapindex 546b17007..f8af0bdf4 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_pr_same_repo.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_same_repo.snap@@ -36,6 +36,8 @@ exit_code: 0----- stderr -----[36m◎[39m [36mFetching PR #101...[39m+[107m [0m [1mFix authentication bug in login flow[22m (#101)+[107m [0m by @alice · open · [90mhttps://github.com/owner/test-repo/pull/101[39m[36m◎[39m [36mFetching [1mfeature-auth[22m from origin...[39m[33m▲[39m [33mWorktree for [1mfeature-auth[22m @ [1m_REPO_.feature-auth[22m, but cannot change directory — shell integration not installed[39m[2m↳[22m [2mTo enable automatic cd, run [90mwt config shell install[39m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_same_repo_no_remote.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_same_repo_no_remote.snapindex 5779a4b40..63ec38371 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_pr_same_repo_no_remote.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_same_repo_no_remote.snap@@ -36,5 +36,7 @@ exit_code: 1----- stderr -----[36m◎[39m [36mFetching PR #101...[39m+[107m [0m [1mFix authentication bug in login flow[22m (#101)+[107m [0m by @alice · open · [90mhttps://github.com/owner/test-repo/pull/101[39m[31m✗[39m [31mNo remote found for [1mowner/test-repo[22m[39m[2m↳[22m [2mAdd the remote: [90mgit remote add upstream https://github.com/owner/test-repo.git[39m[22m