Skip to content

Correct octopus merge conflict message to show both tree IDs#12792

Merged
Byron merged 2 commits intomasterfrom
copilot/fix-issue-12791
Mar 12, 2026
Merged

Correct octopus merge conflict message to show both tree IDs#12792
Byron merged 2 commits intomasterfrom
copilot/fix-issue-12791

Conversation

Copy link
Contributor

Copilot AI commented Mar 11, 2026

In the 2-parent merge conflict path of octopus() (crates/but-rebase/src/merge.rs), the error message printed the same tree hash twice, which obscured which side actually conflicted. This updates the message construction so it reports the conflicting tree and the previously merged tree distinctly.

  • Conflict detail formatting

    • Extracted message suffix construction into merge_conflict_details(...).
    • Updated the 2-parent branch to reference the first successfully merged tree (ours) instead of reusing tree_to_merge.
    • Kept multi-parent/octopus formatting behavior intact (list all successfully merged trees).
  • Defensive behavior

    • Added an explicit defensive empty-slice behavior in merge_conflict_details (empty suffix), with inline context comment.
  • Focused unit coverage

    • Added tests for:
      • 2-parent case (single successfully merged tree),
      • multi-parent case (list of merged trees),
      • defensive empty-input case.
// before (2-parent conflict path):
format!(" and tree {tree_to_merge}") // duplicated hash in final message

// now:
format!(" and tree {}", successfully_merged[0]) // shows the other side

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link

vercel bot commented Mar 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
gitbutler-web Ignored Ignored Preview Mar 12, 2026 5:21am

Request Review

Copilot AI changed the title [WIP] [#12791] Fix issue with user notifications Correct octopus merge conflict message to show both tree IDs Mar 11, 2026
@github-actions github-actions bot added the rust Pull requests that update Rust code label Mar 12, 2026
Copy link
Collaborator

@Byron Byron left a comment

Choose a reason for hiding this comment

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

While this was only an armchair review, I think it's good. The tests cement the desired behaviour as well, and since we had a bug there it's fair to keep them.

@Byron Byron marked this pull request as ready for review March 12, 2026 05:09
Copilot AI review requested due to automatic review settings March 12, 2026 05:09
Copy link
Contributor

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

Refactors the octopus-merge conflict error message formatting in but-rebase by extracting the “previously merged trees” suffix logic into a helper and adding unit tests to pin the output.

Changes:

  • Extracted conflict-details formatting into merge_conflict_details().
  • Updated the octopus merge conflict error to use the new helper.
  • Added unit tests covering 0/1/2 successfully-merged-tree cases.

You can also share your feedback on Copilot code review. Take the survey.

@Byron Byron force-pushed the copilot/fix-issue-12791 branch from 0303438 to 72c4442 Compare March 12, 2026 05:14
@Byron Byron force-pushed the copilot/fix-issue-12791 branch from 72c4442 to ec9042a Compare March 12, 2026 05:21
@Byron Byron enabled auto-merge March 12, 2026 05:21
@Byron Byron merged commit e30c5b2 into master Mar 12, 2026
60 of 62 checks passed
@Byron Byron deleted the copilot/fix-issue-12791 branch March 12, 2026 06:15
mtsgrd pushed a commit that referenced this pull request Mar 12, 2026
Correct octopus merge conflict message to show both tree IDs
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.

Octopus merge error shows the same tree hash twice instead of both sides

3 participants