`gh stack view` silently ignores positional arguments, including a valid different stack number
还没有人认领这个 Issue。
评估
调研方向
从 gh stack view 命令的参数解析开始,复现 issue 中的两个命令,包括它们的退出状态和输出。检查 gh stack checkout 如何处理 stack 编号,然后为有效和无效的位置参数添加覆盖测试。完成的标准是该命令不再静默忽略这些参数:它应该明确拒绝这些参数,或一致地支持 stack 选择。
由索引模型根据 Issue 内容生成。
描述
Summary
gh stack view accepts no positional argument, but supplying one is silently discarded instead of rejected. The harmful case is passing a valid stack number that isn't the current one — you get a different stack's contents, with that stack's number in the header, and no indication your argument was ignored.
On a branch belonging to stack #6, asking for stack #3 (which exists):
$ gh stack view --short 3
Stack #6 <-- rendered #6, not the #3 that was requested
├ stack-b-two ○ #5
» stack-b-one ○ #4 (current)
└ main
$ gh stack view --short garbage999
Stack #6 <-- also silently succeeds
├ stack-b-two ○ #5
» stack-b-one ○ #4 (current)
└ main
Exit status is 0 in both cases.
Why this matters
The output carries a stack number in its header, so it reads as authoritative. Anyone comparing two stacks — or scripting against view — can act on the wrong one without any signal. It is also a natural mistake to make, because gh stack checkout does take a stack number, so the two commands look like they share a selector.
Reproduction
In a repo with two stacks:
git switch <a-branch-in-stack-B>
gh stack view --short <stack-A-number> # shows stack B
gh stack view --short garbage999 # shows stack B
Public repo with two stacks set up for this: https://github.com/xn/gh-stack-repro
Expected
Either error with unknown argument "3" (the usual gh behaviour for unexpected positionals), or accept a stack selector here the way gh stack checkout does. The latter would also give a non-interactive escape hatch for the ambiguity in #415.
Environment
gh2.97.0gh-stackv0.1.0- git 2.50.1
- macOS 26.4.1, darwin/arm64
- 主要语言
- Go
- 星标
- 1.5k
- 派生
- 73
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 7
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/gh-stack 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
-
难度 1/5 1 小时以内 新手友好度 92/100
-
feature request topic: cli - general
难度 2/5 1-3 小时 新手友好度 68/100
-
feature request topic: auto-merge
难度 2/5 1-3 小时 新手友好度 68/100
-
bug topic: docs
难度 1/5 1 小时以内 新手友好度 68/100
相似的 Issue
-
textual definition
难度 1/5 1 小时以内 新手友好度 90/100
geneontology/go-ontology#32653 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
-
needs design
难度 2/5 1-3 小时 新手友好度 75/100
-
Priority/High ready-for-agent Severity/Major Type/Bug
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100