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
cwd: git_root misses a worktree or submodule (.git file) when git cannot run #586
cwd.git_root misses a git worktree or a submodule when git cannot run.
Defect. When git is missing from PATH or fails, the fallback walk in lua/claudecode/cwd.lua tests vim.fn.isdirectory(dir .. "/.git"). A worktree or a submodule has a .gitfile (gitdir: ...), so the walk skips it and returns nil, or a repository above it. With git, the answer is the worktree folder.
Reproduction (on main, Neovim 0.12.3 and 0.8.0):
git init main && git -C main commit --allow-empty -m i
git -C main worktree add ../wt && mkdir wt/sub
Run require("claudecode.cwd").git_root("<R>/wt") and git_root("<R>/wt/sub") once with git on PATH and once with PATH set to an empty folder (vim.o.shell = "/bin/sh"). With git: <R>/wt for both. Without git: nil for both.
Fix. In the walk, also accept vim.fn.filereadable(dir .. "/.git") == 1. Say "a .git folder or file" in lua/claudecode/README.md. Add worktree and submodule cases to the no-git mode of tests/integration/cwd_path_characters_spec.lua (create them with real git, look them up with git off PATH). cwd.lua is covered by verify-diff-lifecycle, so run the full check.sh and --record.
Test cleanup in the same PR (tests/unit/cwd_spec.lua):
Added with the maintainer's agreement (same shell() helper move as above): four more setup commands in tests/lockfile_test.lua do not check their result.
Activity
ThomasK33 commentedon Nov 13, 2026
Added with the maintainer's agreement (same
shell()helper move as above): four more setup commands intests/lockfile_test.luado not check their result.chmodat lines 583, 633 and 904 (on main after test: fail the test when a shell setup command exits with a non-zero status #570): a failedchmodmarks the test pending with a "(root)" reason, so the run stays green and the reason is wrong.mkdir -pat line 416.Route them through the shared
shell()helper, and show each one red with a forced failure (false && <command>) and green normally.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high