[Bug]: a stray .DS_Store in .git/worktrees makes every gh stack command fail
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
首先追踪扫描 .git/worktrees/ 的旧版堆栈状态迁移逻辑;错误指出这里是故障点。按照列出的 git worktree 和 .DS_Store 步骤复现问题,然后运行相关的迁移测试。完成标准是跳过非目录条目,并使 gh stack view、add 和 link 能够正常执行。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
A regular file inside .git/worktrees/ makes every gh stack command fail. On macOS, Finder drops a .DS_Store there as soon as someone opens the directory, so a repo that uses worktrees can end up with one without anyone noticing.
From the error, the state migration treats every entry of .git/worktrees/ as a worktree admin dir and gives up on the first one that isn't a directory. Skipping non-directories there would be enough.
Affected command
gh stack link (also gh stack view, gh stack add)
gh-stack version
gh stack version 0.2.1
GitHub CLI version
gh version 2.102.1 (2026-10-20)
Operating system
macOS 27.0.1
Shell
zsh
Steps to reproduce
git init -b main repo && cd repo
git commit --allow-empty -m init
git worktree add ../wt -b feature
touch .git/worktrees/.DS_Store
gh stack view
gh stack add test-branch
No remote is needed. I hit it on a real repo first, running gh stack link over three pushed branches.
Expected behavior
Files that aren't directories in .git/worktrees/ are skipped, and the command runs.
Actual behavior
The command fails before it does anything. Removing the .DS_Store fixes it.
Terminal output
$ gh stack view
✗ checking legacy stack state: worktree administration path "/…/repo/.git/worktrees/.DS_Store" is not a directory
$ gh stack add test-branch
✗ migrating stack state: worktree administration path "/…/repo/.git/worktrees/.DS_Store" is not a directory
Preflight checks
- I searched the existing issues for duplicates.
- I ran
gh extension upgrade stackand reproduced this issue on the latest stable release.
— printed by Claude Code, signed by me.
- 主要语言
- Go
- 星标
- 1.7k
- 派生
- 82
- 平均合并
- 1 天 5 小时
- 30 天内合并 PR
- 28
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/gh-stack 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
维护者通常 1 天内回复
-
feature request topic: cli - general
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
blinklabs-io/dingo#5636 ·
维护者通常 1 天内回复
-
automated-analysis bug cookie safe-outputs tool-improvement workflow-issue
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
JetBrains/youtrack-cli#130 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
Infisical/infisical#8892 · 1 条评论 ·
维护者通常 1 天内回复
-
windvane requests one more page than it needs可能已有人在做 @TassioSales 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
projectdiscovery/subfinder#1979 ·
维护者通常 3 天内回复