worktree: harden the add prefix check and widen the self-test
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Shell
- Stars
- 0
- Forks
- 0
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nolte/taskfiles
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
-
worktree:add: quote CLI args and derive repo name from the fetch remotePossibly taken @nolte claimed this 11 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 67/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
Similar issues
-
Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
PowerShell/PowerShell#28432 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nolte/kamerplanter-appliance#32 ·
Maintainers usually reply within 1 day
-
research
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
slayerlabs/benchmarks-fabryka-ai#256 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100