mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-08-24 20:16:30 +00:00
fix(e2e): carry binaries and untracked files into the review sandbox
`create --dirty` piped `git diff HEAD` without --binary and copied no untracked files, so a regenerated PNG baseline aborted the patch (leaving a half-built worktree) and a new spec never reached the sandbox — and because the failure printed onto stdout, the caller captured an error string as the sandbox path. Use --binary, copy untracked non-ignored files separately, and trap ERR to tear the worktree down and report on stderr. Verified with a modified baseline plus a new untracked spec: both now arrive in the sandbox. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
5f7a2285be
commit
74099d2bf4
@@ -39,9 +39,22 @@ create() {
|
||||
path="$SANDBOX_ROOT/wt-$$-$(date +%s)"
|
||||
mkdir -p "$SANDBOX_ROOT"
|
||||
git -C "$REPO_ROOT" worktree add --detach --quiet "$path" HEAD
|
||||
# Anything that fails from here leaves a worktree behind, and the caller reads stdout as the
|
||||
# sandbox path — so take the worktree down and say so on stderr rather than printing a stub.
|
||||
trap 'clean "$path" >/dev/null 2>&1; echo "review-sandbox: failed to prepare $path" >&2' ERR
|
||||
|
||||
if [[ -n "$carry_dirty" ]] && ! git -C "$REPO_ROOT" diff --quiet HEAD; then
|
||||
git -C "$REPO_ROOT" diff HEAD | git -C "$path" apply --allow-empty
|
||||
if [[ -n "$carry_dirty" ]]; then
|
||||
# --binary or a regenerated PNG baseline aborts the patch ("cannot apply binary patch
|
||||
# without full index line"). Untracked files are absent from the diff entirely, so a new
|
||||
# spec would never reach the sandbox — copy them separately, minus the ignored ones.
|
||||
if ! git -C "$REPO_ROOT" diff --quiet HEAD; then
|
||||
git -C "$REPO_ROOT" diff HEAD --binary | git -C "$path" apply --allow-empty
|
||||
fi
|
||||
|
||||
while IFS= read -r -d '' file; do
|
||||
mkdir -p "$path/$(dirname "$file")"
|
||||
cp "$REPO_ROOT/$file" "$path/$file"
|
||||
done < <(git -C "$REPO_ROOT" ls-files --others --exclude-standard -z)
|
||||
fi
|
||||
|
||||
if [[ -n "$with_deps" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user