Skip to content

Commit d8ffa2a

Browse files
committed
fix(test): materialize main branch in smoke test before bare clone
The smoke test cloned the repo with --bare, but actions/checkout@v4 only creates the PR branch as refs/heads/, leaving main as a remote-tracking ref. Bare clones don't copy refs/remotes/, so the bare repo had no main, and install.sh's 'git pull origin main' failed on the re-install step in CI. Stage in a working clone where we can materialize main from origin/main (CI case) or fall back to HEAD (local self-test case) before mirroring into the bare repo.
1 parent 527ef10 commit d8ffa2a

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

scripts/smoke_install.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,23 @@ trap 'if [ -z "${KEEP:-}" ]; then rm -rf "$TMP_ROOT"; else echo "kept: $TMP_ROOT
1818
export CLAUDE_CODE_DIR="$TMP_ROOT/.claude"
1919
export TRESOR_DIR="$CLAUDE_CODE_DIR/tresor"
2020

21-
# Prepare a bare local clone the installer can pull from
21+
# Build the upstream repo the installer pulls from. install.sh runs
22+
# `git pull origin main`, so the bare repo must have a `main` branch.
23+
# In CI, actions/checkout only creates the PR branch locally — origin/main
24+
# exists as a remote-tracking ref but not as refs/heads/main, and bare clones
25+
# only copy refs/heads/. Stage in a working clone where we can materialize
26+
# main from origin/main (or HEAD as a self-test fallback).
27+
WORK_CLONE="$TMP_ROOT/work"
2228
LOCAL_BARE="$TMP_ROOT/repo.git"
23-
git clone --quiet --bare "$REPO_ROOT" "$LOCAL_BARE"
29+
git clone --quiet "$REPO_ROOT" "$WORK_CLONE"
30+
if ! git -C "$WORK_CLONE" show-ref --verify --quiet refs/heads/main; then
31+
if git -C "$WORK_CLONE" show-ref --verify --quiet refs/remotes/origin/main; then
32+
git -C "$WORK_CLONE" branch main origin/main
33+
else
34+
git -C "$WORK_CLONE" branch main HEAD
35+
fi
36+
fi
37+
git clone --quiet --bare "$WORK_CLONE" "$LOCAL_BARE"
2438
export TRESOR_REPO_URL="$LOCAL_BARE"
2539

2640
echo "=== smoke: install (fresh) ==="

0 commit comments

Comments
 (0)