Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix(switch): decide branch tracking for --create, whatever the git config says (#3950)

Maximilian Roos1b4c492ee8b2
diff --git a/docs/src/content/docs/switch.md b/docs/src/content/docs/switch.md
index 0fed3f429..cff324c8a 100644
--- a/docs/src/content/docs/switch.md
+++ b/docs/src/content/docs/switch.md
@@ -32,7 +32,7 @@ $ wt switch https://github.com/owner/repo/pull/123 # ...or paste the PR's URL
The `--create` flag creates a new branch from `--base` — the default branch unless specified. Without `--create`, the branch must already exist. Switching to a remote branch (e.g., `wt switch feature` when only `origin/feature` exists) creates a local tracking branch.
-`--create` from a remote base is the exception. For the branch it creates, `wt` defaults git's `branch.autoSetupMerge` to `simple` instead of git's own `true`, so the new branch tracks its base only when the two share a name: `--create release --base origin/release` tracks `origin/release`, while `--create feature --base origin/release` — and the bare `--base release` that resolves to it — gets no upstream. Git's default would have `feature` track `origin/release`, so under `push.default = upstream` a bare `git push` would push the new work to `release`. A `branch.autoSetupMerge` set in git config takes precedence over that default. Publishing such a branch takes `git push --set-upstream origin <branch>`, or git's `push.autoSetupRemote = true` set once, after which a bare `git push` from the new worktree publishes it and configures its tracking.
+One rule decides the upstream, whatever `branch.autoSetupMerge` is set to: a new branch tracks the remote branch it starts from only when the two share a name. Switching to `origin/feature` shares it, so that branch tracks. `--create` need not: `--create release --base origin/release` tracks `origin/release`, while `--create feature --base origin/release` — and the bare `--base release` that resolves to it — gets no upstream. Git's default would have `feature` track `origin/release`, so under `push.default = upstream` a bare `git push` would push the new work to `release`. Publishing such a branch takes `git push --set-upstream origin <branch>`, or git's `push.autoSetupRemote = true` set once, after which a bare `git push` from the new worktree publishes it and configures its tracking.
## Creating worktrees
diff --git a/plugins/worktrunk/skills/worktrunk/reference/switch.md b/plugins/worktrunk/skills/worktrunk/reference/switch.md
index b6a83744c..89ecaa813 100644
--- a/plugins/worktrunk/skills/worktrunk/reference/switch.md
+++ b/plugins/worktrunk/skills/worktrunk/reference/switch.md
@@ -19,7 +19,7 @@ $ wt switch https://github.com/owner/repo/pull/123 # ...or paste the PR's URL
The `--create` flag creates a new branch from `--base` — the default branch unless specified. Without `--create`, the branch must already exist. Switching to a remote branch (e.g., `wt switch feature` when only `origin/feature` exists) creates a local tracking branch.
-`--create` from a remote base is the exception. For the branch it creates, `wt` defaults git's `branch.autoSetupMerge` to `simple` instead of git's own `true`, so the new branch tracks its base only when the two share a name: `--create release --base origin/release` tracks `origin/release`, while `--create feature --base origin/release` — and the bare `--base release` that resolves to it — gets no upstream. Git's default would have `feature` track `origin/release`, so under `push.default = upstream` a bare `git push` would push the new work to `release`. A `branch.autoSetupMerge` set in git config takes precedence over that default. Publishing such a branch takes `git push --set-upstream origin <branch>`, or git's `push.autoSetupRemote = true` set once, after which a bare `git push` from the new worktree publishes it and configures its tracking.
+One rule decides the upstream, whatever `branch.autoSetupMerge` is set to: a new branch tracks the remote branch it starts from only when the two share a name. Switching to `origin/feature` shares it, so that branch tracks. `--create` need not: `--create release --base origin/release` tracks `origin/release`, while `--create feature --base origin/release` — and the bare `--base release` that resolves to it — gets no upstream. Git's default would have `feature` track `origin/release`, so under `push.default = upstream` a bare `git push` would push the new work to `release`. Publishing such a branch takes `git push --set-upstream origin <branch>`, or git's `push.autoSetupRemote = true` set once, after which a bare `git push` from the new worktree publishes it and configures its tracking.
## Creating worktrees
diff --git a/skills/worktrunk/reference/switch.md b/skills/worktrunk/reference/switch.md
index b6a83744c..89ecaa813 100644
--- a/skills/worktrunk/reference/switch.md
+++ b/skills/worktrunk/reference/switch.md
@@ -19,7 +19,7 @@ $ wt switch https://github.com/owner/repo/pull/123 # ...or paste the PR's URL
The `--create` flag creates a new branch from `--base` — the default branch unless specified. Without `--create`, the branch must already exist. Switching to a remote branch (e.g., `wt switch feature` when only `origin/feature` exists) creates a local tracking branch.
-`--create` from a remote base is the exception. For the branch it creates, `wt` defaults git's `branch.autoSetupMerge` to `simple` instead of git's own `true`, so the new branch tracks its base only when the two share a name: `--create release --base origin/release` tracks `origin/release`, while `--create feature --base origin/release` — and the bare `--base release` that resolves to it — gets no upstream. Git's default would have `feature` track `origin/release`, so under `push.default = upstream` a bare `git push` would push the new work to `release`. A `branch.autoSetupMerge` set in git config takes precedence over that default. Publishing such a branch takes `git push --set-upstream origin <branch>`, or git's `push.autoSetupRemote = true` set once, after which a bare `git push` from the new worktree publishes it and configures its tracking.
+One rule decides the upstream, whatever `branch.autoSetupMerge` is set to: a new branch tracks the remote branch it starts from only when the two share a name. Switching to `origin/feature` shares it, so that branch tracks. `--create` need not: `--create release --base origin/release` tracks `origin/release`, while `--create feature --base origin/release` — and the bare `--base release` that resolves to it — gets no upstream. Git's default would have `feature` track `origin/release`, so under `push.default = upstream` a bare `git push` would push the new work to `release`. Publishing such a branch takes `git push --set-upstream origin <branch>`, or git's `push.autoSetupRemote = true` set once, after which a bare `git push` from the new worktree publishes it and configures its tracking.
## Creating worktrees
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 067fccb0d..b596d976a 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -627,7 +627,7 @@ $ wt switch https://github.com/owner/repo/pull/123 # ...or paste the PR's URL
The `--create` flag creates a new branch from `--base` — the default branch unless specified. Without `--create`, the branch must already exist. Switching to a remote branch (e.g., `wt switch feature` when only `origin/feature` exists) creates a local tracking branch.
-`--create` from a remote base is the exception. For the branch it creates, `wt` defaults git's `branch.autoSetupMerge` to `simple` instead of git's own `true`, so the new branch tracks its base only when the two share a name: `--create release --base origin/release` tracks `origin/release`, while `--create feature --base origin/release` — and the bare `--base release` that resolves to it — gets no upstream. Git's default would have `feature` track `origin/release`, so under `push.default = upstream` a bare `git push` would push the new work to `release`. A `branch.autoSetupMerge` set in git config takes precedence over that default. Publishing such a branch takes `git push --set-upstream origin <branch>`, or git's `push.autoSetupRemote = true` set once, after which a bare `git push` from the new worktree publishes it and configures its tracking.
+One rule decides the upstream, whatever `branch.autoSetupMerge` is set to: a new branch tracks the remote branch it starts from only when the two share a name. Switching to `origin/feature` shares it, so that branch tracks. `--create` need not: `--create release --base origin/release` tracks `origin/release`, while `--create feature --base origin/release` — and the bare `--base release` that resolves to it — gets no upstream. Git's default would have `feature` track `origin/release`, so under `push.default = upstream` a bare `git push` would push the new work to `release`. Publishing such a branch takes `git push --set-upstream origin <branch>`, or git's `push.autoSetupRemote = true` set once, after which a bare `git push` from the new worktree publishes it and configures its tracking.
## Creating worktrees
diff --git a/src/commands/worktree/switch.rs b/src/commands/worktree/switch.rs
index 9d8f11ed7..157db6bf5 100644
--- a/src/commands/worktree/switch.rs
+++ b/src/commands/worktree/switch.rs
@@ -468,8 +468,11 @@ fn parse_ref_shortcut(input: &str) -> Option<(RefType, u32)> {
/// returns the remote-qualified form so the validation in
/// [`resolve_switch_target`] doesn't reject `wt switch -c new --base
/// remote-only-branch`. Git's rev-parse doesn't auto-expand `foo` to
-/// `refs/remotes/origin/foo`. The new branch's upstream is unset downstream
-/// to keep `git push` from targeting the base.
+/// `refs/remotes/origin/foo`. `git worktree add` does DWIM the bare form, but
+/// destructively: given `-b <name>` it drops the `-b` and creates the remote
+/// branch's own name instead. So qualifying here is what keeps `--create new-wt
+/// --base remote-only-branch` on `new-wt`, which
+/// `test_switch_create_with_remote_only_base` pins.
fn resolve_base_ref(
repo: &Repository,
base: &str,
@@ -1044,24 +1047,34 @@ fn execute_switch(
let worktree_path_str = worktree_path.to_string_lossy();
let mut args: Vec<&str> = Vec::new();
- // Safety: for an explicitly requested branch, default
- // `branch.autoSetupMerge` to `simple` rather than git's
- // `true`. Under `true`, `git worktree add -b feature
- // origin/main` sets `feature` to track `origin/main`, so a
- // bare `git push` under `push.default = upstream` pushes the
- // new work to `main` (#713). `simple` is git's own narrower
- // mode: it sets tracking only when the new branch's name
- // matches the remote branch's, which is exactly the case
- // where inherited tracking is correct. An explicit setting
- // wins — `wt` picks a different default, it does not override
- // the user's configuration.
+ // Safety: `wt` decides tracking for a branch it creates,
+ // rather than the user's `branch.autoSetupMerge`. `-c`
+ // outranks every config file, so the outcome is the same on
+ // every machine. Git's `simple` is the rule `wt` wants: an
+ // upstream only when the new branch's name matches the remote
+ // branch it starts from, which is exactly when inherited
+ // tracking is right. Git's default `true`, and `always`, would
+ // have `--create feature --base origin/release` track
+ // `origin/release`, so a bare `git push` under
+ // `push.default = upstream` pushes the new work to `release`
+ // (#713); `false` and `inherit` would deny the tracking that is
+ // the point of a same-named branch — `--create release --base
+ // origin/release`, and every DWIM `wt switch feature` from
+ // `origin/feature`, which is the tracking branch the docs
+ // promise. Both paths run under the one rule, so `wt switch`
+ // has one answer to state.
//
- // Only the `--create` paths need it. The DWIM paths below
- // create `feature` from `origin/feature`, where the names
- // match and `simple` and `true` agree.
- if *create_branch && repo.config_value("branch.autoSetupMerge")?.is_none() {
- args.extend(["-c", "branch.autoSetupMerge=simple"]);
- }
+ // `wt` sets git's rule rather than picking `--track` /
+ // `--no-track` from a name comparison of its own, because only
+ // git maps the base back to a remote branch through the fetch
+ // refspec. Splitting `<remote>/<branch>` reads
+ // `team/fork/release` as branch `fork/release`, so the verdict
+ // inverts both ways, and a refspec that renames into a
+ // sub-namespace does the same. `--track` is also a hard demand
+ // where `simple` is best-effort: it fails the whole command
+ // when the base isn't refspec-mapped, as in a single-branch
+ // clone holding a hand-fetched ref.
+ args.extend(["-c", "branch.autoSetupMerge=simple"]);
args.extend(["worktree", "add"]);
diff --git a/src/commands/worktree/types.rs b/src/commands/worktree/types.rs
index eed29f9d6..3e24ca0f6 100644
--- a/src/commands/worktree/types.rs
+++ b/src/commands/worktree/types.rs
@@ -66,11 +66,11 @@ pub enum CreationMethod {
/// When `--base pr:N` / `--base mr:N` (same-repo) is paired with `--create`,
/// the user's intent is "create a new branch tracking the PR/MR's source
/// branch on the remote", so `git push` from the new worktree pushes back
- /// to that PR/MR. `git worktree add -b new <bare-name>` doesn't set up
- /// tracking on its own (only `<remote>/<branch>` triggers DWIM, and even
- /// then we'd unset it via the issue-#713 safety check), so we capture the
- /// (remote, branch) pair here and configure tracking explicitly after
- /// `git worktree add` succeeds. `None` for any other base resolution.
+ /// to that PR/MR. That branch may carry any name, and
+ /// `branch.autoSetupMerge = simple` sets an upstream only where the new
+ /// branch shares it, so we capture the (remote, branch) pair here and
+ /// configure tracking explicitly after `git worktree add` succeeds.
+ /// `None` for any other base resolution.
base_pr_upstream: Option<(String, String)>,
},
/// Fork PR/MR: fetch from refs/pull/N/head or refs/merge-requests/N/head,
diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rs
index 4f3d6f8a9..225fcaa52 100644
--- a/tests/integration_tests/switch.rs
+++ b/tests/integration_tests/switch.rs
@@ -373,29 +373,43 @@ fn test_switch_create_with_remote_only_base(#[from(repo_with_remote)] repo: Test
);
}
-/// `--create` from a remote tracking branch defaults `branch.autoSetupMerge` to
-/// git's `simple` rather than git's own `true`, so the new branch inherits the
-/// base's upstream only when the two share a name. Under `true`, a branch
-/// created from `origin/release` tracks `origin/release`, and a bare `git push`
-/// under `push.default = upstream` pushes the new work to `release` — GitHub
-/// issue #713.
+/// `--create` from a remote tracking branch sets the new branch's upstream only
+/// when the two share a name. Otherwise the branch created from `origin/release`
+/// tracks `origin/release`, and a bare `git push` under `push.default = upstream`
+/// pushes the new work to `release` — GitHub issue #713.
///
-/// An explicit `branch.autoSetupMerge` wins: `wt` picks a different default, it
-/// does not override the setting. The previous implementation — a post-hoc
-/// `git branch --unset-upstream` — overrode every setting, and failed the whole
-/// command with exit 128 whenever the user's config meant git had set no
-/// upstream for it to unset.
-#[rstest]
-fn test_switch_create_from_remote_base_upstream(#[from(repo_with_remote)] repo: TestRepo) {
- // `release` on origin only, so it can serve as a remote base whose name a
- // new branch either shares or doesn't.
+/// `wt` forces `branch.autoSetupMerge = simple` for the creation, so the outcome
+/// is the same under every value the user configures: git's `true` and `always`
+/// would otherwise track a differently-named base, and its `false` and `inherit`
+/// would deny a same-named one the tracking that is the point of it.
+#[rstest]
+fn test_switch_create_from_remote_base_upstream(
+ #[from(repo_with_remote)] repo: TestRepo,
+ #[values(
+ None,
+ Some("simple"),
+ Some("false"),
+ Some("inherit"),
+ Some("true"),
+ Some("always")
+ )]
+ auto_setup_merge: Option<&str>,
+) {
+ if let Some(value) = auto_setup_merge {
+ repo.run_git(&["config", "branch.autoSetupMerge", value]);
+ }
+
+ // `release`, `hotfix`, and `staging` on origin only, so each can serve as a
+ // remote base whose name a new branch either shares or doesn't.
repo.run_git(&["push", "origin", "main:release"]);
+ repo.run_git(&["push", "origin", "main:hotfix"]);
+ repo.run_git(&["push", "origin", "main:staging"]);
repo.run_git(&["fetch", "origin"]);
- let create = |branch: &str| {
+ let create = |branch: &str, base: &str| {
let output = repo
.wt_command()
- .args(["switch", "--create", branch, "--base=origin/release"])
+ .args(["switch", "--create", branch, &format!("--base={base}")])
.output()
.unwrap();
assert!(
@@ -423,25 +437,180 @@ fn test_switch_create_from_remote_base_upstream(#[from(repo_with_remote)] repo:
};
// Different name: no upstream, so a bare `git push` cannot reach `release`.
- create("my-feature");
- assert_eq!(upstream("my-feature"), None);
+ create("my-feature", "origin/release");
+ assert_eq!(upstream("my-feature"), None, "{auto_setup_merge:?}");
+
+ // Same name: the upstream is the new branch's own remote counterpart,
+ // which is what tracking is for.
+ create("release", "origin/release");
+ assert_eq!(
+ upstream("release").as_deref(),
+ Some("origin/release"),
+ "{auto_setup_merge:?}"
+ );
+
+ // A bare base name resolves to the remote-only branch, and is judged by the
+ // same rule once resolved.
+ create("hotfix", "hotfix");
+ assert_eq!(
+ upstream("hotfix").as_deref(),
+ Some("origin/hotfix"),
+ "{auto_setup_merge:?}"
+ );
+
+ // A fully qualified base names the same remote branch, so it tracks too.
+ create("staging", "refs/remotes/origin/staging");
+ assert_eq!(
+ upstream("staging").as_deref(),
+ Some("origin/staging"),
+ "{auto_setup_merge:?}"
+ );
+}
+
+/// The name match is git's to make, because only git maps a remote-tracking ref
+/// back to its branch through the fetch refspec. Splitting `<remote>/<branch>`
+/// at the first slash gets a remote whose own name contains one wrong in both
+/// directions: `team/fork/release` would read as branch `fork/release`, so
+/// `--create fork/release` would be handed the upstream that pushes it to
+/// `release`, and `--create release` would be denied its own counterpart.
+#[rstest]
+fn test_switch_create_base_on_remote_with_slash(#[from(repo_with_remote)] repo: TestRepo) {
+ let origin_url = repo.git_output(&["remote", "get-url", "origin"]);
+ repo.run_git(&["push", "origin", "main:release"]);
+ repo.run_git(&["remote", "add", "team/fork", origin_url.trim()]);
+ repo.run_git(&["fetch", "team/fork"]);
+
+ let create = |branch: &str| {
+ let output = repo
+ .wt_command()
+ .args(["switch", "--create", branch, "--base=team/fork/release"])
+ .output()
+ .unwrap();
+ assert!(
+ output.status.success(),
+ "switch --create {branch} should succeed; stderr: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ };
+
+ let upstream = |branch: &str| -> Option<String> {
+ let output = repo
+ .git_command()
+ .args([
+ "rev-parse",
+ "--abbrev-ref",
+ &format!("{branch}@{{upstream}}"),
+ ])
+ .run()
+ .unwrap();
+ output
+ .status
+ .success()
+ .then(|| String::from_utf8_lossy(&output.stdout).trim().to_string())
+ };
+
+ create("fork/release");
+ assert_eq!(
+ upstream("fork/release"),
+ None,
+ "fork/release must not inherit the base's upstream"
+ );
- // Same name: the tracking git would set points at the branch's own remote
- // counterpart, which is what tracking is for — it stays.
create("release");
- assert_eq!(upstream("release").as_deref(), Some("origin/release"));
+ assert_eq!(
+ upstream("release").as_deref(),
+ Some("team/fork/release"),
+ "release is the base's own counterpart"
+ );
+}
- // `false` means git sets no upstream at all; nothing to undo, nothing to fail.
- repo.run_git(&["config", "branch.autoSetupMerge", "false"]);
- create("no-auto-setup");
- assert_eq!(upstream("no-auto-setup"), None);
+/// Switching to a remote-only branch creates the tracking branch the docs
+/// promise. The names match by construction here, so the same rule `--create`
+/// runs under settles it; the values worth enumerating are the two that would
+/// otherwise leave the branch with no upstream, against the default and the
+/// most permissive as controls.
+#[rstest]
+fn test_switch_dwim_from_remote_tracks(
+ #[from(repo_with_remote)] repo: TestRepo,
+ #[values(None, Some("false"), Some("inherit"), Some("always"))] auto_setup_merge: Option<&str>,
+) {
+ if let Some(value) = auto_setup_merge {
+ repo.run_git(&["config", "branch.autoSetupMerge", value]);
+ }
+ repo.run_git(&["branch", "dwim-feature"]);
+ repo.run_git(&["push", "origin", "dwim-feature"]);
+ repo.run_git(&["branch", "-D", "dwim-feature"]);
- // `always` is the user asking for git's inheriting behaviour explicitly.
- repo.run_git(&["config", "branch.autoSetupMerge", "always"]);
- create("explicit-always");
+ let output = repo
+ .wt_command()
+ .args(["switch", "dwim-feature"])
+ .output()
+ .unwrap();
+ assert!(
+ output.status.success(),
+ "switch dwim-feature should succeed; stderr: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+
+ let upstream = repo
+ .git_command()
+ .args(["rev-parse", "--abbrev-ref", "dwim-feature@{upstream}"])
+ .run()
+ .unwrap();
+ assert!(
+ upstream.status.success(),
+ "dwim-feature should track its remote counterpart ({auto_setup_merge:?})"
+ );
assert_eq!(
- upstream("explicit-always").as_deref(),
- Some("origin/release")
+ String::from_utf8_lossy(&upstream.stdout).trim(),
+ "origin/dwim-feature",
+ "{auto_setup_merge:?}"
+ );
+}
+
+/// A remote-tracking ref the fetch refspec doesn't map — hand-fetched into a
+/// single-branch clone — still creates its worktree. Git's `simple` declines the
+/// tracking it can't work out; `git worktree add --track` would fail the whole
+/// command with "starting point 'origin/release' is not a branch", after the
+/// branch name has already been taken.
+#[rstest]
+fn test_switch_create_base_outside_fetch_refspec(#[from(repo_with_remote)] repo: TestRepo) {
+ repo.run_git(&["push", "origin", "main:release"]);
+ repo.run_git(&[
+ "config",
+ "remote.origin.fetch",
+ "+refs/heads/main:refs/remotes/origin/main",
+ ]);
+ repo.run_git(&[
+ "fetch",
+ "origin",
+ "refs/heads/release:refs/remotes/origin/release",
+ ]);
+
+ let output = repo
+ .wt_command()
+ .args(["switch", "--create", "release", "--base=origin/release"])
+ .output()
+ .unwrap();
+ assert!(
+ output.status.success(),
+ "switch --create release should succeed; stderr: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ let branches = repo.git_output(&["branch", "--list", "release"]);
+ assert!(branches.contains("release"), "release should be created");
+
+ // `simple` declines the tracking rather than guessing at it: git can't work
+ // out which remote branch `origin/release` stands for without a refspec.
+ let upstream = repo
+ .git_command()
+ .args(["rev-parse", "--abbrev-ref", "release@{upstream}"])
+ .run()
+ .unwrap();
+ assert!(
+ !upstream.status.success(),
+ "release should have no upstream, got {}",
+ String::from_utf8_lossy(&upstream.stdout).trim()
);
}
diff --git a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
index 6141422dc..f2ba35bc9 100644
--- a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
@@ -148,8 +148,8 @@ Worktrees are addressed by branch name; paths are computed from a configurable t
The --create flag creates a new branch from --base — the default branch unless specified. Without --create, the branch must already exist. Switching to a remote branch (e.g., wt switch feature when only origin/feature exists) creates a local tracking branch.
---create from a remote base is the exception. For the branch it creates, wt defaults git's branch.autoSetupMerge to simple instead of git's own true, so the new branch tracks its base only when the two share a name: --create release --base origin/release tracks origin/release, while --create feature --base origin/release — and the bare --base release that resolves to it — gets no upstream. Git's default would have feature track origin/release, so under push.default = upstream a bare git push
-would push the new work to release. A branch.autoSetupMerge set in git config takes precedence over that default. Publishing such a branch takes git push --set-upstream origin <branch>, or git's push.autoSetupRemote = true set once, after which a bare git push from the new worktree publishes it and configures its tracking.
+One rule decides the upstream, whatever branch.autoSetupMerge is set to: a new branch tracks the remote branch it starts from only when the two share a name. Switching to origin/feature shares it, so that branch tracks. --create need not: --create release --base origin/release tracks origin/release, while --create feature --base origin/release — and the bare --base release that resolves to it — gets no upstream. Git's default would have feature track origin/release, so under push.default =
+upstream a bare git push would push the new work to release. Publishing such a branch takes git push --set-upstream origin <branch>, or git's push.autoSetupRemote = true set once, after which a bare git push from the new worktree publishes it and configures its tracking.
Creating worktrees
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_dwim_ambiguous_remotes.snap b/tests/snapshots/integration__integration_tests__switch__switch_dwim_ambiguous_remotes.snap
index c0c400a5f..5e7ef15a4 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_dwim_ambiguous_remotes.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_dwim_ambiguous_remotes.snap
@@ -7,12 +7,23 @@ info:
- shared-feature
env:
APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
CLICOLOR_FORCE: "1"
COLUMNS: "500"
+ GIT_ALLOW_PROTOCOL: file
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_AUTHOR_EMAIL: [email protected]
+ GIT_AUTHOR_NAME: Test User
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
+ GIT_COMMITTER_EMAIL: [email protected]
+ GIT_COMMITTER_NAME: Test User
+ GIT_CONFIG_COUNT: "2"
+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig
+ GIT_CONFIG_KEY_0: user.useConfigOnly
+ GIT_CONFIG_KEY_1: rerere.enabled
+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig
+ GIT_CONFIG_VALUE_0: "true"
+ GIT_CONFIG_VALUE_1: "false"
GIT_TERMINAL_PROMPT: "0"
HOME: "[TEST_HOME]"
LANG: C
@@ -35,8 +46,10 @@ info:
WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
WORKTRUNK_TEST_ZSH_INSTALLED: "0"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -49,4 +62,4 @@ exit_code: 1
✗ Failed to create worktree for shared-feature
  fatal: invalid reference: shared-feature
↳ Failed command, exit code 128:
-  git worktree add -- _REPO_.shared-feature shared-feature
+  git -c branch.autoSetupMerge=simple worktree add -- _REPO_.shared-feature shared-feature