fix: fix: review-pr.sh runs git commands before cd-ing to project repo — fails after image rebuild (#408)
This commit is contained in:
parent
a704acb7ba
commit
2164991313
1 changed files with 5 additions and 2 deletions
|
|
@ -35,6 +35,10 @@ git -C "$FACTORY_ROOT" pull --ff-only origin main 2>/dev/null || true
|
|||
|
||||
# --- Config ---
|
||||
PR_NUMBER="${1:?Usage: review-pr.sh <pr-number> [--force]}"
|
||||
|
||||
# Change to project repo early — required before any git commands
|
||||
# (factory root is not a git repo after image rebuild)
|
||||
cd "${PROJECT_REPO_ROOT}"
|
||||
FORCE="${2:-}"
|
||||
API="${FORGE_API}"
|
||||
LOGFILE="${DISINTO_LOG_DIR}/review/review.log"
|
||||
|
|
@ -163,12 +167,11 @@ DNOTE=""; [ "$FSIZE" -gt "$MAX_DIFF" ] && DNOTE=" (truncated from ${FSIZE} bytes
|
|||
# =============================================================================
|
||||
# WORKTREE SETUP
|
||||
# =============================================================================
|
||||
cd "${PROJECT_REPO_ROOT}"
|
||||
git fetch "${FORGE_REMOTE}" "$PR_HEAD" 2>/dev/null || true
|
||||
|
||||
if [ -d "$WORKTREE" ]; then
|
||||
cd "$WORKTREE"; git checkout --detach "$PR_SHA" 2>/dev/null || {
|
||||
cd "${PROJECT_REPO_ROOT}"; worktree_cleanup "$WORKTREE"
|
||||
worktree_cleanup "$WORKTREE"
|
||||
git worktree add "$WORKTREE" "$PR_SHA" --detach 2>/dev/null; }
|
||||
else
|
||||
git worktree add "$WORKTREE" "$PR_SHA" --detach 2>/dev/null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue