From 9fc8f9da974c3d895fb6ad16e80dff68648af36e Mon Sep 17 00:00:00 2001 From: Griffin Long <151978260+DrunkOnJava@users.noreply.github.com> Date: Mon, 26 Oct 2026 13:56:52 -0400 Subject: [PATCH] fix(ci): refresh.sh resets the train's worktree before checking out the next PR A dry refresh, or one that failed after regenerating the baseline or the coverage page, left those files modified, and git merge --abort does not touch them; the next checkout then refused (#298 review). --- tools/maintainer/train/refresh.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/maintainer/train/refresh.sh b/tools/maintainer/train/refresh.sh index 4a53fb57..90737526 100755 --- a/tools/maintainer/train/refresh.sh +++ b/tools/maintainer/train/refresh.sh @@ -34,6 +34,8 @@ git rev-parse origin/main > "$OUT/main.sha" [ -d "$TRAIN_WORKTREE" ] || git worktree add -q --detach "$TRAIN_WORKTREE" origin/main || exit 2 cd "$TRAIN_WORKTREE" || exit 2 git merge --abort > /dev/null 2>&1 +# The worktree is the train's own: a failed or dry refresh can leave regenerated files behind. +git reset -q --hard git checkout -q --detach "origin/$B" || exit 2 base=$(git rev-parse HEAD) map=$(python3 -I "$TRAIN_HERE/arch.py" renumber "$(git merge-base origin/main HEAD)" origin/main 2> "$OUT/renumber.log") || { say "REFUSED: section renumber failed: $(cat "$OUT/renumber.log")"; exit 4; }