--mount-git-worktree-common-dir silently ignored when devcontainer.json sets a custom workspaceMount
@v-Mathiyarasy ci sta già lavorando.
Dal 11/6/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Summary
--mount-git-worktree-common-dir (added in #1127) has no effect when the devcontainer.json defines a custom workspaceMount. The worktree common-dir bind mount is never added, so in-container git fails with fatal: not a git repository for any git worktree whose devcontainer uses a custom workspaceMount.
Root cause
In src/spec-node/utils.ts (getWorkspaceConfiguration, ~L386) the entire worktree detection + common-dir mount block is guarded by:
if (workspace && (!workspaceFolder || !('workspaceMount' in config))) { ... }
When workspaceMount is present, the block is skipped — the .git file is never read, the common dir is never resolved, and no mount is added. (Flagged as a possible oversight by @kapouer in #796, Mar 2026.)
Reproduction (CLI 0.82.0, git 2.52)
git init main && (cd main && git commit --allow-empty -m init && git worktree add --relative-paths ../wt)- Add
wt/.devcontainer/devcontainer.jsonwith a customworkspaceMount, e.g.:{ "image": "mcr.microsoft.com/devcontainers/base:debian", "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind", "workspaceFolder": "/workspace" } devcontainer up --workspace-folder wt --mount-git-worktree-common-dir truedevcontainer exec --workspace-folder wt -- git -C /workspace status→fatal: not a git repository: (null)docker inspecton the container shows only the workspace bind mount; the worktree common dir was not mounted.
Removing workspaceMount makes it work — confirming the guard is the cause.
Expected
The common-dir mount should be computed and added even when a custom workspaceMount is set, by resolving the mount target relative to the configured workspaceMount target / workspaceFolder. This is the common case for monorepos that mount a parent directory and set workspaceFolder to a subpath. Relates to #796.
Workaround
Adding the common dir manually via a mounts entry (binding the main repo's .git to the path the worktree's .git file resolves to inside the container) restores in-container git — matching the maintainer's earlier suggestion in #796.
- Lingua principale
- TypeScript
- Stelle
- 3k
- Fork
- 461
- Merge medio
- 18m
- PR unite (30g)
- 5
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di devcontainers/cli
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
devcontainers/cli#1203 ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 68/100
devcontainers/cli#1178 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
devcontainers/cli#1308 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
devcontainers/cli#1307 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
devcontainers/cli#1305 ·
Tutte le issue di devcontainers/cli
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
fil-donadoni/tolaria#4409 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
corsairdev/corsair#1764 ·