diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-20 16:28:55 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-20 16:28:55 -0500 |
| commit | acbe2a0bf8de038556beb33701129fb3ca4580df (patch) | |
| tree | e68680e0b39fd9e8bb8236eaff11b085b4e4bc24 | |
| parent | b6334da771d764b7c29b33522db06b6cc716c6cb (diff) | |
Fix duplicate worktree command
| -rwxr-xr-x | Omni/Agent/setup-worker.sh | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Omni/Agent/setup-worker.sh b/Omni/Agent/setup-worker.sh index 27a9939..28c29b1 100755 --- a/Omni/Agent/setup-worker.sh +++ b/Omni/Agent/setup-worker.sh @@ -11,17 +11,14 @@ WORKER_NAME="$1" REPO_ROOT="$(git rev-parse --show-toplevel)" WORKTREE_PATH="$REPO_ROOT/../$WORKER_NAME" -echo "Creating worktree at $WORKTREE_PATH..." -git worktree add "$WORKTREE_PATH" live +# We create a new branch for the worker based on 'live' +# This avoids the "branch already checked out" error if 'live' is checked out elsewhere +BRANCH_NAME="${WORKER_NAME}" +echo "Creating worktree '$WORKTREE_PATH' on branch '$BRANCH_NAME' (from live)..." +git worktree add -b "$BRANCH_NAME" "$WORKTREE_PATH" live # Copy .envrc.local if it exists (user-specific config) if [ -f "$REPO_ROOT/.envrc.local" ]; then echo "Copying .envrc.local..." cp "$REPO_ROOT/.envrc.local" "$WORKTREE_PATH/" fi - -# We create a new branch for the worker based on 'live' -# This avoids the "branch already checked out" error if 'live' is checked out elsewhere -BRANCH_NAME="${WORKER_NAME}" -echo "Creating worktree '$WORKTREE_PATH' on branch '$BRANCH_NAME' (from live)..." -git worktree add -b "$BRANCH_NAME" "$WORKTREE_PATH" live |
