worktree: harden the add prefix check and widen the self-test

Aperta
#53 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@nolte ci sta già lavorando.

Dal 5/11/2026.

  • #58 di @nolte — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
git, shell
Ambito
cli, testing

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 "*) … esac test, so no loop exit status can leak under set -e in 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 sed that reads WORKTREE_ALLOWED_PREFIXES only 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 to task -t <module> add.
  • Add negative cases for the slug guard (*/*, *..*), "Destination already exists", and the usage exit code (2).
  • git init -b develop needs git ≥ 2.28; use git init + git symbolic-ref HEAD refs/heads/develop for portability.
Lingua principale
Shell
Stelle
0
Fork
0
Merge medio
11m
PR unite (30g)
2

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nolte/taskfiles

Tutte le issue di nolte/taskfiles

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.