Skip to content

fix(stack): Rebase branch in dry-run mode for accurate plan output#974

Open
remyduthu wants to merge 1 commit intomainfrom
devs/remyduthu/fix-dry-run/If1e56b2bd38dc668e57ffb814b06436225e6837d
Open

fix(stack): Rebase branch in dry-run mode for accurate plan output#974
remyduthu wants to merge 1 commit intomainfrom
devs/remyduthu/fix-dry-run/If1e56b2bd38dc668e57ffb814b06436225e6837d

Conversation

@remyduthu
Copy link
Contributor

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

Copilot AI review requested due to automatic review settings February 18, 2026 14:43
@mergify mergify bot had a problem deploying to Mergify Merge Protections February 18, 2026 14:43 Failure
@remyduthu remyduthu self-assigned this Feb 18, 2026
@mergify
Copy link
Contributor

mergify bot commented Feb 18, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🔴 👀 Review Requirements

This rule is failing.
  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🔴 🔎 Reviews

This rule is failing.
  • #review-requested = 0
  • #review-threads-unresolved = 0
  • #changes-requested-reviews-by = 0

🟢 🤖 Continuous Integration

Wonderful, this rule succeeded.
  • all of:
    • check-success=ci-gate

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?:

🟢 📕 PR description

Wonderful, this rule succeeded.
  • body ~= (?ms:.{48,})

@mergify
Copy link
Contributor

mergify bot commented Feb 18, 2026

🧪 CI Insights

Here's what we observed from your CI run for 988e64b.

🟢 All jobs passed!

But CI Insights is watching 👀

@remyduthu remyduthu marked this pull request as ready for review February 18, 2026 14:45
@mergify mergify bot requested a review from a team February 18, 2026 14:46
JulianMaurin
JulianMaurin previously approved these changes Feb 18, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 of dry_run flag (only respects skip_rebase flag)
  • 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.

@remyduthu remyduthu requested a review from a team February 18, 2026 15:05
Copy link
Member

@sileht sileht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
jd previously requested changes Feb 18, 2026
Copy link
Member

@jd jd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@remyduthu remyduthu force-pushed the devs/remyduthu/fix-dry-run/If1e56b2bd38dc668e57ffb814b06436225e6837d branch from f6adf56 to 988e64b Compare February 19, 2026 10:34
@mergify mergify bot dismissed stale reviews from JulianMaurin and jd February 19, 2026 10:34

Pull request has been modified.

@mergify mergify bot had a problem deploying to Mergify Merge Protections February 19, 2026 10:34 Failure
@mergify mergify bot requested a review from a team February 19, 2026 10:36
Comment on lines +217 to +220
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[/]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@mergify mergify bot requested a review from a team February 19, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants

Comments