Remove V8's custom upload_cl.sh, edit_cl_description.sh, and validate_cl_description.py scripts and align V8's git-cl and git-commit rules with Chromium's shared git-cl-helper skill (72-char title limit, git cl description -n +). Retain V8's worktree isolation, mandatory regression test, stacked CL, and WIP-by-default guardrails in git-cl.md. TAG=agy R=leszeks@chromium.org Change-Id: Ieee756f06b183204c941f4d063ded32036048d88 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8617944 Reviewed-by: Leszek Swirski <leszeks@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/main@{#110946}
67 lines
2.0 KiB
Bash
Executable File
67 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Copyright 2026 the V8 project authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
TASK_ID=$1
|
|
BASE_BRANCH="${2:-origin/main}"
|
|
if [ -z "$TASK_ID" ]; then
|
|
echo "Usage: create_worktree.sh <task_id> [base_branch]"
|
|
exit 1
|
|
fi
|
|
|
|
TOPLEVEL=$(git rev-parse --show-toplevel 2>/dev/null)
|
|
COMMON_DIR=$(git rev-parse --git-common-dir 2>/dev/null)
|
|
if [ -z "$COMMON_DIR" ] || [ -z "$TOPLEVEL" ]; then
|
|
echo "Error: Not in a git repository."
|
|
exit 1
|
|
fi
|
|
V8_ROOT="$(cd "$COMMON_DIR/.." && pwd)"
|
|
WS_ROOT="$(dirname "$TOPLEVEL")"
|
|
|
|
if command -v rift >/dev/null 2>&1 && [ -f "$WS_ROOT/.rift_prime_directive.json" ]; then
|
|
CURRENT_WS="$(basename "$WS_ROOT")"
|
|
RIFT_PARENT_DIR="$(dirname "$WS_ROOT")"
|
|
REPO_DIR_NAME="$(basename "$TOPLEVEL")"
|
|
|
|
if [[ "$TASK_ID" == "${CURRENT_WS}_subagent_"* ]]; then
|
|
SUBAGENT_WS="$TASK_ID"
|
|
else
|
|
SUBAGENT_WS="${CURRENT_WS}_subagent_${TASK_ID}"
|
|
fi
|
|
WORKTREE_PATH="$RIFT_PARENT_DIR/$SUBAGENT_WS/$REPO_DIR_NAME"
|
|
|
|
if [ ! -d "$WORKTREE_PATH" ]; then
|
|
# Attempt Rift's subagent fork command as documented in the rift skill.
|
|
# Fallback to standard 'rift fork' if the subagent subcommand fails or is unsupported.
|
|
if ! rift -y subagent fork "$TASK_ID" > /dev/null 2>&1; then
|
|
rift fork -y "$SUBAGENT_WS" --no-build > /dev/null 2>&1
|
|
fi
|
|
fi
|
|
|
|
if [ ! -d "$WORKTREE_PATH" ]; then
|
|
echo "Error: Failed to create rift workspace $SUBAGENT_WS" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "$WORKTREE_PATH"
|
|
exit 0
|
|
fi
|
|
|
|
BRANCH_NAME="task-$TASK_ID"
|
|
WORKTREE_PATH="$V8_ROOT/worktrees/$BRANCH_NAME"
|
|
|
|
mkdir -p "$V8_ROOT/worktrees"
|
|
|
|
if ! git worktree add --track -b "$BRANCH_NAME" "$WORKTREE_PATH" "$BASE_BRANCH" 2>/dev/null && \
|
|
! git worktree add -b "$BRANCH_NAME" "$WORKTREE_PATH" "$BASE_BRANCH"; then
|
|
echo "Error: Failed to create git worktree at $WORKTREE_PATH" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! python3 "$V8_ROOT/tools/dev/setup_worktree_build.py" "$V8_ROOT" "$WORKTREE_PATH"; then
|
|
echo "Error: Failed to set up dependencies for $WORKTREE_PATH" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "$WORKTREE_PATH"
|