Skip to content

Commit 9ae1499

Browse files
nicksenapclaude
andcommitted
Fix e2e sync: only create main branch on detached HEAD
The previous fix unconditionally created a main branch, which overrode the real branch name (master) on non-PR runs, causing sync to rebase onto origin/master while checking origin/main. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d38a7a2 commit 9ae1499

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

e2e/run.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ done
4242
GROVE_SRC="${GROVE_SRC:-/src/grove}"
4343
if [ -d "${GROVE_SRC}/.git" ]; then
4444
git clone -q --local "${GROVE_SRC}" "${REPOS_DIR}/grove"
45-
# Ensure we're on a named branch (CI checkouts may be detached HEAD)
46-
(cd "${REPOS_DIR}/grove" && git checkout -q -B main HEAD 2>/dev/null || true)
45+
# CI PR checkouts are detached HEAD — create a branch so the sync test works
46+
if ! (cd "${REPOS_DIR}/grove" && git symbolic-ref --short HEAD 2>/dev/null) >/dev/null 2>&1; then
47+
(cd "${REPOS_DIR}/grove" && git checkout -q -B main HEAD)
48+
fi
4749
echo "Cloned Grove repo ($(cd "${REPOS_DIR}/grove" && git rev-list --count HEAD) commits)"
4850
else
4951
# Fallback: create a bare origin + clone so we have proper remote refs

0 commit comments

Comments
 (0)