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 天內回覆