You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: A project inside another repository silently uses that ancestor repository for worktrees #31250
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
Have a Git repository at a parent folder, e.g. C:\Dev (in my case a stray git init with no commits).
Create an empty, non-Git folder below it, e.g. C:\Dev\Active\Robotics Playground.
Add that folder as a project in T3 Code.
Start a new thread in a new worktree.
Expected behavior
T3 Code notices that the project folder is not itself a repository root (git rev-parse --show-toplevel returns an ancestor) and either treats the project as non-Git, or warns and offers to initialize a repository at the project folder. Worktrees, branches and checkpoints should not silently operate on a repository that contains much more than the project.
Actual behavior
T3 Code silently uses the ancestor repository. Here that repo had no commits, so setup failed with:
Workspace preparation failed during provision worktree: Git command failed in GitVcsDriver.createWorktree.createBranch (C:\Dev\Active\Robotics Playground): git worktree add failed (ref_not_found)
The error names the project folder, not C:\Dev, so there is no hint that a different repository is involved. Diagnosing it needed git rev-parse --show-toplevel by hand. The empty-repo failure itself is #22017 (fix in #24427); this issue is about the ancestor repo being adopted without notice. If the ancestor repo had commits, worktrees would be created from the whole parent tree instead of the project.
Possibly related: the stray C:\Dev\.git had grown to ~21 GB / ~776k loose objects with no commits, refs or index, written across many hours, which looks like repeated snapshotting of the whole parent tree (cf. #26227). I can't confirm T3 wrote them.
Impact
Major degradation or frequent failure
Version or commit
T3 Code (Beta) desktop, exe ProductVersion 0.1.6.0
Environment
Windows 11 Pro 26200, git 2.49.0.windows.1
Logs or stack traces
PS C:\Dev\Active\Robotics Playground> git rev-parse --show-toplevel
C:/Dev
PS C:\Dev\Active\Robotics Playground> git status -sb
## No commits yet on master
Workaround
git init plus an initial commit in the project folder, and delete the stray parent .git.
Activity