Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: a stray .DS_Store in .git/worktrees makes every gh stack command fail

未关闭 适合新手
#587 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
git, github, go
领域
cli, tooling

调研方向

首先追踪扫描 .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 stack and 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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/gh-stack 的其他 Issue

查看 github/gh-stack 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。