Summary
With a repository whose git directory lives outside the work tree (git init --separate-git-dir <store>, so .git is a file pointing at <store>), wt switch --create resolves {{ repo_path }} to the parent of the git directory, not to the work tree. The new worktree is created next to the store, and wt list shows the main worktree's path as the store as well.
Repro (wt v0.79.0, macOS, clean HOME with no user config)
mkdir -p repro/store repro/work repro/home
git init --separate-git-dir "$PWD/repro/store/repo.gitdir" repro/work
git -C repro/work commit -q --allow-empty -m init
cd repro/work
HOME="$PWD/../home" wt switch --create probe --no-cd --format=json
Output:
{"action":"created","branch":"probe","path":"<…>/repro/store.probe","created_branch":true,"base_branch":"main"}
Expected path is <…>/repro/work.probe (a sibling of the work tree, per the default {{ repo_path }}.{{ branch }} template).
wt list in the same state:
Branch Status … Path Commit Age Message
^ main · ·^ . 562ed3b now init
+ probe _ ../store.probe 562ed3b now init
Likely cause
git worktree list itself reports the git directory as the main worktree entry in this layout:
<…>/repro/store/repo.gitdir 562ed3b [main]
<…>/repro/store.probe 562ed3b [probe]
so anything deriving the repo path from that first line lands on the store. Running git worktree repair (which writes the <store>/gitdir backlink, content <…>/repro/work/.git) does not change the result: a second wt switch --create probe2 still lands at <…>/repro/store.probe2.
Two sources that do give the work tree in this layout: git rev-parse --show-toplevel run from the main work tree, or the <gitdir>/gitdir backlink file (present after git worktree repair, absent right after git init --separate-git-dir).
Workaround
A per-project entry with an absolute worktree-path in the user config avoids the wrong placement, but wt list still shows the store as the main worktree's path.
Environment
- wt v0.79.0 (also the latest release as of 2026-09-21)
- git 2.x, macOS 26
- 7 repositories on this machine use this layout (git dir kept outside a cloud-synced folder); all reproduce.
Summary
With a repository whose git directory lives outside the work tree (
git init --separate-git-dir <store>, so.gitis a file pointing at<store>),wt switch --createresolves{{ repo_path }}to the parent of the git directory, not to the work tree. The new worktree is created next to the store, andwt listshows the main worktree's path as the store as well.Repro (wt v0.79.0, macOS, clean
HOMEwith no user config)Output:
{"action":"created","branch":"probe","path":"<…>/repro/store.probe","created_branch":true,"base_branch":"main"}Expected
pathis<…>/repro/work.probe(a sibling of the work tree, per the default{{ repo_path }}.{{ branch }}template).wt listin the same state:Likely cause
git worktree listitself reports the git directory as the main worktree entry in this layout:so anything deriving the repo path from that first line lands on the store. Running
git worktree repair(which writes the<store>/gitdirbacklink, content<…>/repro/work/.git) does not change the result: a secondwt switch --create probe2still lands at<…>/repro/store.probe2.Two sources that do give the work tree in this layout:
git rev-parse --show-toplevelrun from the main work tree, or the<gitdir>/gitdirbacklink file (present aftergit worktree repair, absent right aftergit init --separate-git-dir).Workaround
A per-project entry with an absolute
worktree-pathin the user config avoids the wrong placement, butwt liststill shows the store as the main worktree's path.Environment