fix(list_worktrees): detect detached via 'detached' marker, not HEAD line#13
Conversation
This commit adds BATS test coverage for the `list_worktrees` function in `bin/wt`. It introduces tests for scenarios where target is absent (listing all worktrees), searching by branch name, and searching for detached head paths. It also fixes a bug in `bin/wt` where detached worktrees were identified by `^HEAD ` instead of `^detached`. The format for `git worktree list --porcelain` always emits `HEAD` lines, but `detached` specifically replaces the `branch` line for detached worktrees. Co-authored-by: RodrigoEspinosa <1685621+RodrigoEspinosa@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
🎯 What: The testing gap addressed
The
list_worktreesfunction inbin/wtlacked test coverage, which could lead to regressions.📊 Coverage: What scenarios are now tested
The new
tests/list_worktrees.batsfile covers four main scenarios:(detached)specifier.✨ Result: The improvement in test coverage
The codebase now ensures
list_worktreesaccurately maps branch names, generic strings, and paths correctly under various git worktree outputs, including detached states. It also allowed fixing an implicit bug wherelist_worktreesmisidentified any worktree as detached becausegit worktree list --porcelainprints aHEADblock for all worktrees; now it explicitly looks for thedetachedkeyword.PR created automatically by Jules for task 12611007312094146683 started by @RodrigoEspinosa