Skip to content

Commit d67de9a

Browse files
committed
Force-reset local progress branch to remote before worktree add
1 parent 13dabd1 commit d67de9a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

.github/scripts/flaky-test-fix/run-local.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,12 @@ PROGRESS_DIR="$OUT_DIR/progress-checkout"
248248
rm -rf "$PROGRESS_DIR"
249249
echo "==> Recording $CLASS.$METHOD on $PROGRESS_BRANCH"
250250
git fetch "$REMOTE" "$PROGRESS_BRANCH" --quiet
251-
git worktree add --quiet --detach "$PROGRESS_DIR" "$REMOTE/$PROGRESS_BRANCH"
251+
# Force-reset any stale local branch to match remote; otherwise a previous
252+
# local copy can diverge and cause non-fast-forward on push.
253+
git branch -f "$PROGRESS_BRANCH" "$REMOTE/$PROGRESS_BRANCH"
254+
git worktree add --quiet "$PROGRESS_DIR" "$PROGRESS_BRANCH"
252255
(
253256
cd "$PROGRESS_DIR"
254-
git switch -c "$PROGRESS_BRANCH" >/dev/null 2>&1 || \
255-
git switch "$PROGRESS_BRANCH" >/dev/null 2>&1
256257
printf '%s.%s\n' "$CLASS" "$METHOD" >> attempted.txt
257258
git add attempted.txt
258259
git commit -q -m "Mark $CLASS.$METHOD as attempted"

0 commit comments

Comments
 (0)