fix: skip base-branch merge in worktree for cherry-pick operations#1062
fix: skip base-branch merge in worktree for cherry-pick operations#1062
Conversation
Add skip_merge parameter to _checkout_worktree() and pass skip_merge=True when called from cherry_pick(). The default merge of origin/main into the worktree is unnecessary for cherry-picks (which manage their own branch setup) and breaks when the PR has conflicts with main.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe pull request adds a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
|
/build-and-push-container |
|
New container for ghcr.io/myk-org/github-webhook-server:pr-1062 published |
|
/verified |
Summary
_checkout_worktree()mergesorigin/{base_branch}into the PR branch for PR testing purposescherry_pick(), this merge is unnecessary — cherry-pick has its own setup commands that checkout the target branchneeds-rebase), this merge fails and aborts the cherry-pick before it even startsskip_merge=Trueparameter to skip the merge step for cherry-pick operationsBug Details
Reported on RedHatQE/openshift-virtualization-tests#3455:
/cherry-pick cnv-4.20failed silently (no PR comment posted) because_checkout_worktree()tried to mergeorigin/maininto the PR branch, which had conflicts.The bug was latent since commit 8c7bd27 (2025-11-13, "perf(git): replace multiple clones with single clone + worktrees"). It only manifests when cherry-picking a PR that has conflicts with its base branch — otherwise the merge succeeds harmlessly and is immediately discarded by cherry-pick's own setup commands.
Test plan
skip_merge=Trueprevents merge command executioncherry_pick()passesskip_merge=Trueto_checkout_worktree()Summary by CodeRabbit
Release Notes
Bug Fixes
Tests