Skip to content

fix: prevent duplicate content in merge-previous-releases auto-merge - #283

Open
sleepytanya wants to merge 2 commits into
mainfrom
fix/merge-previous-releases-prevent-duplicate-content
Open

fix: prevent duplicate content in merge-previous-releases auto-merge#283
sleepytanya wants to merge 2 commits into
mainfrom
fix/merge-previous-releases-prevent-duplicate-content

Conversation

@sleepytanya

@sleepytanya sleepytanya commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

When merging older RCs into a new RC, git's auto-merge can create duplicate content (e.g., duplicate locale keys) when both branches have identical changes. This happens because git doesn't recognize the changes are the same and tries to combine them.

Fix: use --no-commit --no-ff, then reset all files to destination before committing. This preserves merge history while keeping destination content.

Fixes: https://consensyssoftware.atlassian.net/browse/MCRM-143


Note

Medium Risk
Changes release-branch automation that pushes merge commits; behavior now discards any post-merge tree differences from older RCs in favor of the new branch, which is intentional but affects production release flows.

Overview
Fixes merge-previous-releases so merging an older RC into a new one no longer duplicates content (e.g. repeated locale keys) when both branches contain the same edits—Git was combining identical changes instead of treating them as one.

merge_with_favor_destination no longer relies on -X ours and per-file conflict resolution. It runs git merge --no-commit --no-ff, then git checkout HEAD -- . to force the working tree to match the new RC, stages (still excluding github-tools), and commits the merge. Merge history is kept; file content always matches the destination branch.

The script header comments and CHANGELOG document the new behavior and link PR #283.

Reviewed by Cursor Bugbot for commit cc52e72. Bugbot is set up for automated code reviews on this repo. Configure here.

@sleepytanya sleepytanya changed the title Prevent duplicate content fix: prevent duplicate content in merge-previous-releases auto-merge Aug 27, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d0cc55f. Configure here.

Comment thread .github/scripts/merge-previous-releases.sh
@cursor
cursor Bot requested review from Gudahtt and XxdpavelxX August 27, 2026 03:08
@sleepytanya
sleepytanya requested a review from tommasini August 27, 2026 03:13
fi
# Reset all files to destination (new RC) version
echo "Resetting all files to destination branch version..."
git checkout HEAD -- . 2>/dev/null || true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Gudahtt
Two edge cases: a) if old RC has content not yet in main, it gets discarded; b) if destination deleted file that source has, it gets un-deleted. Not sure if this can happen in real life?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant