fix(gsd): skip current milestone in syncWorktreeStateBack to prevent merge conflicts

syncWorktreeStateBack copied all milestone directories including the one
being merged. This caused dirty-tree conflicts when mergeMilestoneToMain
ran because the files already existed from the copy-back.

Now skips the current milestoneId in the sync loop since its files are
already in the milestone branch being merged.

Closes #3641

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tibsfox 2026-04-06 19:11:14 -07:00
parent b4c6229360
commit 16b61a7789

View file

@ -770,6 +770,9 @@ export function syncWorktreeStateBack(
.map((d) => d.name);
for (const mid of wtMilestones) {
// Skip the current milestone being merged — its files are already in the
// milestone branch and would conflict with the squash merge (#3641).
if (mid === milestoneId) continue;
syncMilestoneDir(wtGsd, mainGsd, mid, synced);
}
} catch (err) {