From 51c00867e05965ecf4e01092249995df2711c764 Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 29 Oct 2025 22:41:13 -0400 Subject: [PATCH] fix: revert squash_pr.sh I had introduced issues --- scripts/merge-train/squash-pr.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/merge-train/squash-pr.sh b/scripts/merge-train/squash-pr.sh index 6a2cb5d9f658..65e883c446c0 100755 --- a/scripts/merge-train/squash-pr.sh +++ b/scripts/merge-train/squash-pr.sh @@ -39,13 +39,17 @@ cd "$worktree_dir" git config user.name "$pr_author" git config user.email "$author_email" -# Save our current branch commit +# Save our current branch commits original_head=$(git rev-parse HEAD) -# Deepen our history for comparisons -git fetch --depth=200 origin "$base_sha" -git fetch --depth=200 origin "$base_sha" -git fetch --depth=200 origin "$base_branch" +# Deepen by 50 to ensure we have the base commit +git fetch --deepen=50 + +# Fetch the base commit with depth +git fetch --depth=50 origin "$base_sha" + +# Fetch the base branch to ensure we have it +git fetch origin "$base_branch" # Find the merge-base between our branch and the base branch merge_base=$(git merge-base "$original_head" "origin/$base_branch") @@ -89,10 +93,10 @@ git commit -m "$commit_message" --no-verify if [[ "$is_fork" == "true" ]]; then # It's a fork - need to push to the fork repository echo "Detected fork: pushing to $head_repo" - + # Add the fork as a remote (assumes GITHUB_TOKEN env var is set from workflow) git remote add fork "https://x-access-token:${GITHUB_TOKEN}@github.com/${head_repo}.git" - + # Push to the fork git push --force fork "HEAD:refs/heads/$branch" else