Skip to content

fix(sync): don't treat branches with no commits as merged#80

Merged
javoire merged 2 commits intomainfrom
jd/fix-sync-empty-branch-merge-detection
Mar 16, 2026
Merged

fix(sync): don't treat branches with no commits as merged#80
javoire merged 2 commits intomainfrom
jd/fix-sync-empty-branch-merge-detection

Conversation

@javoire
Copy link
Owner

@javoire javoire commented Mar 16, 2026

Summary

  • Fix stack sync falsely detecting branches with no commits as "merged" and switching to main
  • The git-history merge detection used IsAncestor(branch, origin/main) which trivially returns true for branches pointing to the same commit as main
  • Added a reverse ancestry check — if both directions are true, the commits are identical (new branch, not merged)
  • Applied to both branch-level and parent-branch merge detection paths

🤖 Generated with Claude Code

javoire and others added 2 commits March 16, 2026 10:58
Branches with no unique commits point to the same commit as main, so
IsAncestor() trivially returns true — falsely detecting them as merged
and switching to main. Fix by adding a reverse ancestry check: if both
directions are true, the commits are identical (new branch, not merged).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… case

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@javoire javoire marked this pull request as ready for review March 16, 2026 16:01
@javoire javoire merged commit 8b4279c into main Mar 16, 2026
1 check passed
@javoire javoire deleted the jd/fix-sync-empty-branch-merge-detection branch March 16, 2026 16:01
javoire pushed a commit that referenced this pull request Mar 16, 2026
…026-03-16)

### Bug Fixes

* **sync:** don't treat branches with no commits as merged ([#80](#80)) ([8b4279c](8b4279c))
@javoire
Copy link
Owner Author

javoire commented Mar 16, 2026

🎉 This PR is included in version 1.22.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant