fix(stack): Rebase branch in dry-run mode for accurate plan output#974
fix(stack): Rebase branch in dry-run mode for accurate plan output#974
Conversation
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 👀 Review RequirementsThis rule is failing.
🔴 🔎 ReviewsThis rule is failing.
🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
🧪 CI InsightsHere's what we observed from your CI run for 988e64b. 🟢 All jobs passed!But CI Insights is watching 👀 |
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where the dry-run mode in mergify stack push was showing stale pre-rebase commit hashes, making the plan output inconsistent with what would actually be pushed. The fix ensures that rebase is always performed unless --skip-rebase is explicitly passed, even in dry-run mode.
Changes:
- Modified
stack_push()to perform rebase regardless ofdry_runflag (only respectsskip_rebaseflag) - Added two new test cases to verify rebase behavior in dry-run mode with and without
--skip-rebase
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| mergify_cli/stack/push.py | Removed the if not dry_run condition wrapping the rebase logic, so rebase now runs in dry-run mode unless --skip-rebase is set |
| mergify_cli/tests/stack/test_push.py | Added test_stack_dry_run_rebases() and test_stack_dry_run_skip_rebase() to verify the new behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sileht
left a comment
There was a problem hiding this comment.
It's weird to have a dry-run command that changes the git tree.
Instead, we should detect if a rebase is needed or not, or something like this, no?
jd
left a comment
There was a problem hiding this comment.
It's not a dry run if you do the rebase.
The dry-run plan was showing stale pre-rebase commit hashes, making its output inconsistent with actual push. Rebase is now always performed unless --skip-rebase is explicitly passed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Change-Id: If1e56b2bd38dc668e57ffb814b06436225e6837d
f6adf56 to
988e64b
Compare
Pull request has been modified.
| console.log( | ||
| f"[orange]branch `{dest_branch}` is behind `{remote}/{base_branch}` " | ||
| f"by {behind} {'commit' if behind == '1' else 'commits'}, " | ||
| f"commit SHAs may differ after rebase[/]", |
There was a problem hiding this comment.
They will differ after rebase, they have to. So while you can't print the sha1 you sould still show the [to-update] I think?
The dry-run plan was showing stale pre-rebase commit hashes, making its
output inconsistent with actual push. Rebase is now always performed
unless --skip-rebase is explicitly passed.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com