worktree: harden the add prefix check and widen the self-test
评估
调研方向
Read src/taskfile-include-worktree.yaml and tests/worktree-selftest.sh; the issue lists the module changes and self-test cases. Start by running the self-test and checking how its Taskfile invokes add, including through an includes: wrapper. Done when the prefix checks and messages are hardened, all listed negative cases and wrapper invocation are covered, and the tests work with portable branch setup.
由索引模型根据 Issue 内容生成。
描述
Follow-up from the review of #52 (fix for #50). None of these block #52; they reduce the chance the same class of defect comes back.
Module (src/taskfile-include-worktree.yaml, add)
- Replace the prefix loop with a single
case " $allowed_prefixes " in *" $prefix "*) … esactest, so no loop exit status can leak underset -ein go-task's mvdan/sh. - Check
[ "$prefix" != "$branch" ](branch has a/) once, before the prefix test, and give it its own message ("branch lacks a prefix" vs. "prefix not allowed").
Self-test (tests/worktree-selftest.sh)
- The
sedthat readsWORKTREE_ALLOWED_PREFIXESonly handles a plain literal. When the module is converted to the'{{.NAME | default "…"}}'form CLAUDE.md requires, it exits 2 ("Could not read…"). Read the resolved value instead, or handle both forms. - Exercise the module through an
includes:wrapper Taskfile (as consumers do) in addition totask -t <module> add. - Add negative cases for the slug guard (
*/*,*..*), "Destination already exists", and the usage exit code (2). git init -b developneeds git ≥ 2.28; usegit init+git symbolic-ref HEAD refs/heads/developfor portability.
- 主要语言
- Shell
- 星标
- 0
- 派生
- 0
- 平均合并
- 11 分钟
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nolte/taskfiles 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 67/100
-
documentation
难度 1/5 1 小时以内 新手友好度 88/100
-
难度 3/5 1-2 天 新手友好度 76/100
-
worktree:add: quote CLI args and derive repo name from the fetch remote可能已有人在做 @nolte 于 11 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 67/100
-
难度 4/5 3-5 天 新手友好度 52/100
相似的 Issue
-
Needs-Triage
难度 2/5 1-3 小时 新手友好度 84/100
PowerShell/PowerShell#28432 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
nolte/kamerplanter-appliance#32 ·
维护者通常 1 天内回复
-
research
难度 2/5 1-3 小时 新手友好度 76/100
slayerlabs/benchmarks-fabryka-ai#256 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100