-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Currently, subgit-sync has to be limited to running on a single branch. This bug is backed by a (currently broken) test, aptly named branch_confusion.
The basic gist of it that if someone pushes to master in the upstream, then pushes to a feature branch branched from master in the upstream, a commit to master in the subgit will take the commit from the feature branch and add it to the master branch.
The problem is, when the feature branch is merged, we now have two mappings for a the master branch in the subgit:
subgit_master_sha -> upstream_feature_sha
subgit_master_sha -> upstream_master_sha
So that's saying the commit in the subgit for master is the commit you would use in the subgit for adding a commit to the upstream_feature_sha commit or the upstream_master_sha. The issue is that when copying commits from the subgit, we just pick the most recent. The fix would be to exclude any mappings that aren't in the target branch we're looking to pick to, which gets tricky.
One possible solution is to take the old_sha from the branch we're pushing to and looking up the mapping based off of that, but I'm not sure how that'd hold up in the face of merge commits and such.