fix(stack): carry the revision note onto the rewritten commit#1729
Conversation
|
This pull request is part of a Mergify stack:
|
Merge Protections🟢 All 6 merge protections satisfied — ready to merge. Show 6 satisfied protections🟢 🤖 Continuous Integration
🟢 👀 Review Requirements
🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 Reviews
🟢 📕 PR description
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
898bb48 to
4c82e38
Compare
Revision history
|
There was a problem hiding this comment.
Pull request overview
This PR fixes stack note/revision-note loss across rewritten commits by ensuring Git notes under the stack notes ref are copied forward during rebases and other rewrite operations. It does so by persisting notes.rewriteRef in the local repo config via stack setup, and by pinning rewrite behavior via per-invocation git -c ... overrides for the CLI-driven rebases/pulls.
Changes:
- Add a reusable git
-cconfig bundle to force notes rewrite behavior during CLI-driven rebases. - Ensure
stack sync’sgit pull --rebasepath also carries the notes rewrite config. - Extend
stack setupto addnotes.rewriteRef=refs/notes/mergify/stackto local git config and surface that outcome in CLI output, with regression tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| crates/mergify-stack/src/git.rs | Adds notes-rewrite -c overrides to scripted rebases and a regression test to ensure stack notes survive rewrites. |
| crates/mergify-stack/src/commands/sync.rs | Applies the notes-rewrite config to the pull --rebase fast-path so notes are preserved there too. |
| crates/mergify-stack/src/commands/setup.rs | Persists notes.rewriteRef in local repo config (for out-of-process rewrites like commit --amend) and adds an idempotency test. |
| crates/mergify-cli/src/main.rs | Prints a confirmation when stack setup adds the new notes.rewriteRef config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
A note is addressed by commit SHA, so every rewrite stranded it. The rebase `stack push` runs before it reads notes back left the reason on the pre-rebase SHA, and the revision history recorded a blank `Reason`; a plain `git commit --amend` lost it the same way. `stack setup` now adds a local `notes.rewriteRef`, which is what covers the rewrites git runs on its own — `git commit --amend`, and the `git rebase --continue` that finishes a conflicted rebase. The CLI's own rebases pass the same settings with `-c` so they stay correct in checkouts whose config predates this, and so a global `notes.rewriteMode=ignore` cannot disable the copy. Existing checkouts pick the config up on their next `mergify stack setup`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Change-Id: I0e5503e0eeddcc02c689eb78581b8c211b2dd741
4c82e38 to
39b4faa
Compare
Merge Queue Status
This pull request spent 6 minutes 32 seconds in the queue, including 6 minutes 13 seconds running CI. Required conditions to merge
|
A note is addressed by commit SHA, so every rewrite stranded it. The
rebase
stack pushruns before it reads notes back left the reason onthe pre-rebase SHA, and the revision history recorded a blank
Reason;a plain
git commit --amendlost it the same way.stack setupnow adds a localnotes.rewriteRef, which is what coversthe rewrites git runs on its own —
git commit --amend, and thegit rebase --continuethat finishes a conflicted rebase. The CLI's ownrebases pass the same settings with
-cso they stay correct incheckouts whose config predates this, and so a global
notes.rewriteMode=ignorecannot disable the copy. Existing checkoutspick the config up on their next
mergify stack setup.Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com