Keep conflict markers when rewording a conflicted commit - #15310
Merged
Conversation
Reword swapped in the new message wholesale, dropping the [conflict] prefix and the GitButler-Conflict trailer. The commit no longer read as conflicted while its tree kept the conflict layout, so commit details rendered every .conflict-* file as a change — enough to OOM the lite renderer. Re-mark the message like the legacy engine does; regression test on a new message-marked fixture.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a regression in but reword where rewording a conflicted commit replaced the message wholesale and could drop the conflict message markers ([conflict] prefix and GitButler-Conflict: trailer). That caused the commit to stop registering as conflicted even though its tree still had the conflict layout, leading to pathological rendering (e.g., many .conflict-* paths showing as changes).
Changes:
- Route reworded messages through
but_core::commit::rewrite_conflict_markers_on_message_changeto preserve conflict markers when appropriate. - Add a regression test that rewords a message-marked conflicted commit and asserts the conflicted state remains intact.
- Introduce a new test fixture repository scenario with a conflicted commit encoded via the message trailer (without the legacy
gitbutler-conflictedheader).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/but-workspace/src/commit/reword.rs | Preserve conflict markers when applying a new commit message during reword. |
| crates/but-workspace/tests/workspace/commit/reword.rs | Add regression coverage for rewording a trailer-marked conflicted commit. |
| crates/but-workspace/tests/fixtures/scenario/with-conflict-marked-message.sh | New fixture creating a conflicted commit marked via message prefix/trailer (no legacy header). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
but rewordon a conflicted commit swapped in the new message wholesale, dropping the[conflict]prefix and theGitButler-Conflict:trailer. The commit stopped registering as conflicted while its tree kept the conflict layout — commit details then rendered every.conflict-*file as a change, enough to OOM the lite renderer.Fix: route the new message through
rewrite_conflict_markers_on_message_change, same as the legacy rebase engine already does. Regression test rewords a message-marked conflicted commit; that needed a new fixture, since the existing one encodes conflict state in the legacy header, which reword never touched.