Skip to content

fix: resolve target path before PWD comparison in wrktr_remove - #4

Merged
gentbot merged 1 commit into
mainfrom
review-for-vulns
Jun 5, 2026
Merged

gentbot merged 1 commit into
mainfrom
review-for-vulns

Conversation

@gentbot

@gentbot gentbot commented Jun 5, 2026

Copy link
Copy Markdown
Owner

On macOS, $BATS_TMPDIR resolves through /tmp → /private/tmp, causing
the "inside worktree" safety check to silently miss when target contained
the unresolved symlink path. Resolve both sides with pwd -P before
comparing.

Update two wrktr_unload test assertions from exact string match to =~
since $output includes the sourcing banner ahead of the echoed value.

What and why

Changes

Checklist

All PRs

  • bats tests/ passes locally
  • shellcheck worktree-functions.sh passes locally
  • CHANGELOG.md updated (add entry under [Unreleased])

New public functions

  • Docblock above function follows the project format
  • [ "$1" = "--help" ] && { wrktr_help <name>; return 0; } guard present
  • wrktr_validate || return 1 at top (for session-dependent functions)
  • Dry-run support: _wrktr_run wraps mutations; _wrktr_is_dryrun gates conditional logic
  • Error messages use _wrktr_breaker red "..." (writes to stderr)
  • Help entry added to wrktr_help case statement
  • Documentation added to docs/wrktr.md function reference
  • Row added to Quick reference table in docs/wrktr.md
  • Tab completion registered if function takes branch or session names
  • Tests added to tests/wrktr.bats (at least one success, one failure)

Behavior changes to existing functions

  • Describe whether the change is backwards-compatible
  • Existing tests updated to reflect new behavior
  • docs/wrktr.md updated if command usage or behavior description changed

On macOS, $BATS_TMPDIR resolves through /tmp → /private/tmp, causing
  the "inside worktree" safety check to silently miss when target contained
  the unresolved symlink path. Resolve both sides with pwd -P before
  comparing.

  Update two wrktr_unload test assertions from exact string match to =~
  since $output includes the sourcing banner ahead of the echoed value.
@gentbot
gentbot merged commit bd17e2e into main Jun 5, 2026
14 checks passed
@gentbot
gentbot deleted the review-for-vulns branch June 5, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant