Skip to content

Commit 76ceea4

Browse files
pontemontiCopilot
andauthored
Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 0010e82 commit 76ceea4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.claude/commands/resolve-review.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ Git worktree allows you to work on a different branch without changing your curr
6868

6969
5. Create a worktree with the new branch based on the PR branch:
7070
```bash
71-
git worktree add .worktrees/pr-<PR_NUMBER>-fixes -b <FIX_BRANCH_NAME> origin/<PR_HEAD_BRANCH>
71+
PR_HEAD_BRANCH="$(gh pr view "$PR_NUMBER" --json headRefName --jq '.headRefName')"
72+
# Validate branch name to avoid command injection; allow only typical branch-name characters
73+
if ! printf '%s\n' "$PR_HEAD_BRANCH" | grep -Eq '^[A-Za-z0-9._/\-]+$'; then
74+
echo "Error: Unsafe PR head branch name: $PR_HEAD_BRANCH" >&2
75+
exit 1
76+
fi
77+
78+
git worktree add ".worktrees/pr-$PR_NUMBER-fixes" -b "$FIX_BRANCH_NAME" "origin/$PR_HEAD_BRANCH"
7279
```
7380

7481
6. **CRITICAL**: All subsequent file reads, edits, and git operations for fixes must happen in the worktree directory (`.worktrees/pr-<PR_NUMBER>-fixes/`), NOT the main repository.

0 commit comments

Comments
 (0)