cwd: git_root follows a symlink by name when git cannot run
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
阅读 lua/claudecode/cwd.lua 和 tests/integration/cwd_path_characters_spec.lua 中的无 Git 模式。先检查回退遍历和 simplify() 如何处理符号链接,然后在两侧使用 realpath 将结果与真实 Git 进行比较。当 Git 不可用时,link 和 link/.. 案例与 Git 结果一致即可完成;issue 还要求为 verify-diff-lifecycle 提供 check.sh 和 --record。
由索引模型根据 Issue 内容生成。
描述
cwd.git_root follows a symbolic link by its name when git cannot run, so it answers with the wrong repository.
Defect. The fallback walk in lua/claudecode/cwd.lua is lexical. For a start folder that is a link into another repository, it tests the link's own folder, then the folders above the link's name. It answers the repository of the link's parent, where git answers the repository of the link target. A .. after a link (X/lnk/..) is also resolved by name by simplify(), while git resolves it through the target.
Reproduction (on main, Neovim 0.12.3 and 0.8.0):
git init r1 && git init r2 && mkdir -p r1/sub r2/deep
ln -s "$PWD/r2/deep" r1/sub/lnk
require("claudecode.cwd").git_root("<R>/r1/sub/lnk") gives <R>/r2 with git and <R>/r1 with git off PATH.
Fix. Start the walk from vim.loop.fs_realpath(start_dir) (available in Neovim 0.8) and fall back to the lexical path when it returns nil. The answer is then the physical repository path, as git rev-parse --show-toplevel returns it. Add a link case and a link/.. case to the no-git mode of tests/integration/cwd_path_characters_spec.lua, compared against real git with realpath on both sides (macOS has /tmp as a link). Full check.sh and --record for verify-diff-lifecycle.
Owner: the next maintainer pass on cwd.lua, together with the worktree issue. Deferred from the README verification run with the maintainer's agreement.
Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high
- 主要语言
- Lua
- 星标
- 3.2k
- 派生
- 223
- 平均合并
- 6 小时 7 分钟
- 30 天内合并 PR
- 210
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
coder/claudecode.nvim 的其他 Issue
-
needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
coder/claudecode.nvim#588 ·
维护者通常 1 天内回复
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 72/100
coder/claudecode.nvim#313 ·
维护者通常 1 天内回复
-
needs-triage
难度 4/5 3-5 天 新手友好度 56/100
coder/claudecode.nvim#590 ·
维护者通常 1 天内回复
-
needs-triage
难度 4/5 3-5 天 新手友好度 56/100
coder/claudecode.nvim#589 ·
维护者通常 1 天内回复
-
needs-triage
难度 3/5 1-2 天 新手友好度 58/100
coder/claudecode.nvim#586 ·
维护者通常 1 天内回复
查看 coder/claudecode.nvim 的全部 Issue
相似的 Issue
-
documentation night-shift
难度 1/5 1 小时以内 新手友好度 90/100
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
nvim-telescope/telescope.nvim#3718 ·
维护者通常 1 天内回复
-
bug discord guide:leatherworking locale:enUS triage v0.3.6
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
Data Correction Forever
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复