Skip to content

Keep conflict markers when rewording a conflicted commit - #15310

Merged
mtsgrd merged 1 commit into
masterfrom
reword-keeps-conflict-markers
Aug 13, 2026
Merged

Keep conflict markers when rewording a conflicted commit#15310
mtsgrd merged 1 commit into
masterfrom
reword-keeps-conflict-markers

Conversation

@mtsgrd

@mtsgrd mtsgrd commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

but reword on a conflicted commit swapped in the new message wholesale, dropping the [conflict] prefix and the GitButler-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.

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.
@github-actions github-actions Bot added the rust Pull requests that update Rust code label Aug 12, 2026
@mtsgrd
mtsgrd marked this pull request as ready for review August 13, 2026 06:30
Copilot AI lite review requested due to automatic review settings August 13, 2026 06:30
@mtsgrd
mtsgrd merged commit 1fb4895 into master Aug 13, 2026
44 checks passed
@mtsgrd
mtsgrd deleted the reword-keeps-conflict-markers branch August 13, 2026 06:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_change to 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-conflicted header).

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants